Internet Engineering Task Force (IETF)                  J. Schoenwaelder
Request for Comments: 6643                             Jacobs University
Category: Standards Track                                      July 2012
ISSN: 2070-1721
        
Internet Engineering Task Force (IETF)                  J. Schoenwaelder
Request for Comments: 6643                             Jacobs University
Category: Standards Track                                      July 2012
ISSN: 2070-1721
        

Translation of Structure of Management Information Version 2 (SMIv2) MIB Modules to YANG Modules

将管理信息版本2(SMIv2)MIB模块的结构转换为YANG模块

Abstract

摘要

YANG is a data modeling language used to model configuration and state data manipulated by the Network Configuration Protocol (NETCONF), NETCONF remote procedure calls, and NETCONF notifications. The Structure of Management Information (SMIv2) defines fundamental data types, an object model, and the rules for writing and revising MIB modules for use with the Simple Network Management Protocol (SNMP). This document defines a translation of SMIv2 MIB modules into YANG modules, enabling read-only (config false) access to data objects defined in SMIv2 MIB modules via NETCONF.

YANG是一种数据建模语言,用于对网络配置协议(NETCONF)、NETCONF远程过程调用和NETCONF通知操作的配置和状态数据进行建模。管理信息结构(SMIv2)定义了基本数据类型、对象模型以及编写和修改MIB模块以与简单网络管理协议(SNMP)一起使用的规则。本文档定义了SMIv2 MIB模块到YANG模块的转换,允许通过NETCONF对SMIv2 MIB模块中定义的数据对象进行只读(config false)访问。

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

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

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

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

Copyright Notice

版权公告

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

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

This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://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文件的法律规定的约束(http://trustee.ietf.org/license-info)自本文件出版之日起生效。请仔细阅读这些文件,因为它们描述了您对本文件的权利和限制。从本文件中提取的代码组件必须包括信托法律条款第4.e节中所述的简化BSD许可证文本,并提供简化BSD许可证中所述的无担保。

This document may contain material from IETF Documents or IETF Contributions published or made publicly available before November 10, 2008. The person(s) controlling the copyright in some of this material may not have granted the IETF Trust the right to allow modifications of such material outside the IETF Standards Process. Without obtaining an adequate license from the person(s) controlling the copyright in such materials, this document may not be modified outside the IETF Standards Process, and derivative works of it may not be created outside the IETF Standards Process, except to format it for publication as an RFC or to translate it into languages other than English.

本文件可能包含2008年11月10日之前发布或公开的IETF文件或IETF贡献中的材料。控制某些材料版权的人员可能未授予IETF信托允许在IETF标准流程之外修改此类材料的权利。在未从控制此类材料版权的人员处获得充分许可的情况下,不得在IETF标准流程之外修改本文件,也不得在IETF标准流程之外创建其衍生作品,除了将其格式化以RFC形式发布或将其翻译成英语以外的其他语言。

Table of Contents

目录

   1.  Introduction . . . . . . . . . . . . . . . . . . . . . . . . .  4
   2.  Mapping of Well-Known Types  . . . . . . . . . . . . . . . . .  4
   3.  Translation of SMIv2 Modules and SMIv2 IMPORT Clauses  . . . .  5
     3.1.  Example: IMPORTS of IF-MIB . . . . . . . . . . . . . . . .  6
   4.  Translation of the MODULE-IDENTITY Macro . . . . . . . . . . .  7
     4.1.  MODULE-IDENTITY Translation Rules  . . . . . . . . . . . .  7
     4.2.  Example: MODULE-IDENTITY of IF-MIB . . . . . . . . . . . .  8
   5.  Translation of the TEXTUAL-CONVENTION Macro  . . . . . . . . .  9
     5.1.  TEXTUAL-CONVENTION Translation Rules . . . . . . . . . . .  9
     5.2.  Example: OwnerString and InterfaceIndex of IF-MIB  . . . . 10
     5.3.  Example: IfDirection of the DIFFSERV-MIB . . . . . . . . . 11
   6.  Translation of OBJECT IDENTIFIER Assignments . . . . . . . . . 11
   7.  Translation of the OBJECT-TYPE Macro . . . . . . . . . . . . . 11
     7.1.  Scalar and Columnar Object Translation Rules . . . . . . . 11
     7.2.  Example: ifNumber and ifIndex of the IF-MIB  . . . . . . . 13
     7.3.  Non-Augmenting Conceptual Table Translation Rules  . . . . 13
     7.4.  Example: ifTable of the IF-MIB . . . . . . . . . . . . . . 15
     7.5.  Example: ifRcvAddressTable of the IF-MIB . . . . . . . . . 16
     7.6.  Example: alHostTable of the RMON2-MIB  . . . . . . . . . . 17
     7.7.  Augmenting Conceptual Tables Translation Rules . . . . . . 18
     7.8.  Example: ifXTable of the IF-MIB  . . . . . . . . . . . . . 20
   8.  Translation of the OBJECT-IDENTITY Macro . . . . . . . . . . . 21
     8.1.  OBJECT-IDENTITY Translation Rules  . . . . . . . . . . . . 21
     8.2.  Example: diffServTBParamSimpleTokenBucket of the
           DIFFSERV-MIB . . . . . . . . . . . . . . . . . . . . . . . 21
   9.  Translation of the NOTIFICATION-TYPE Macro . . . . . . . . . . 22
     9.1.  NOTIFICATION-TYPE Translation Rules  . . . . . . . . . . . 22
     9.2.  Example: linkDown NOTIFICATION-TYPE of IF-MIB  . . . . . . 23
   10. YANG Language Extension Definition . . . . . . . . . . . . . . 24
   11. Implementing Configuration Data Nodes  . . . . . . . . . . . . 27
     11.1. Example: addressMapControlTable of RMON2-MIB . . . . . . . 28
   12. IANA Considerations  . . . . . . . . . . . . . . . . . . . . . 30
   13. Security Considerations  . . . . . . . . . . . . . . . . . . . 30
   14. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 31
   15. References . . . . . . . . . . . . . . . . . . . . . . . . . . 31
     15.1. Normative References . . . . . . . . . . . . . . . . . . . 31
     15.2. Informative References . . . . . . . . . . . . . . . . . . 31
   Appendix A.  Mapping of Well-Known Types (Normative) . . . . . . . 33
   Appendix B.  Module Prefix Generation (Informative)  . . . . . . . 35
        
   1.  Introduction . . . . . . . . . . . . . . . . . . . . . . . . .  4
   2.  Mapping of Well-Known Types  . . . . . . . . . . . . . . . . .  4
   3.  Translation of SMIv2 Modules and SMIv2 IMPORT Clauses  . . . .  5
     3.1.  Example: IMPORTS of IF-MIB . . . . . . . . . . . . . . . .  6
   4.  Translation of the MODULE-IDENTITY Macro . . . . . . . . . . .  7
     4.1.  MODULE-IDENTITY Translation Rules  . . . . . . . . . . . .  7
     4.2.  Example: MODULE-IDENTITY of IF-MIB . . . . . . . . . . . .  8
   5.  Translation of the TEXTUAL-CONVENTION Macro  . . . . . . . . .  9
     5.1.  TEXTUAL-CONVENTION Translation Rules . . . . . . . . . . .  9
     5.2.  Example: OwnerString and InterfaceIndex of IF-MIB  . . . . 10
     5.3.  Example: IfDirection of the DIFFSERV-MIB . . . . . . . . . 11
   6.  Translation of OBJECT IDENTIFIER Assignments . . . . . . . . . 11
   7.  Translation of the OBJECT-TYPE Macro . . . . . . . . . . . . . 11
     7.1.  Scalar and Columnar Object Translation Rules . . . . . . . 11
     7.2.  Example: ifNumber and ifIndex of the IF-MIB  . . . . . . . 13
     7.3.  Non-Augmenting Conceptual Table Translation Rules  . . . . 13
     7.4.  Example: ifTable of the IF-MIB . . . . . . . . . . . . . . 15
     7.5.  Example: ifRcvAddressTable of the IF-MIB . . . . . . . . . 16
     7.6.  Example: alHostTable of the RMON2-MIB  . . . . . . . . . . 17
     7.7.  Augmenting Conceptual Tables Translation Rules . . . . . . 18
     7.8.  Example: ifXTable of the IF-MIB  . . . . . . . . . . . . . 20
   8.  Translation of the OBJECT-IDENTITY Macro . . . . . . . . . . . 21
     8.1.  OBJECT-IDENTITY Translation Rules  . . . . . . . . . . . . 21
     8.2.  Example: diffServTBParamSimpleTokenBucket of the
           DIFFSERV-MIB . . . . . . . . . . . . . . . . . . . . . . . 21
   9.  Translation of the NOTIFICATION-TYPE Macro . . . . . . . . . . 22
     9.1.  NOTIFICATION-TYPE Translation Rules  . . . . . . . . . . . 22
     9.2.  Example: linkDown NOTIFICATION-TYPE of IF-MIB  . . . . . . 23
   10. YANG Language Extension Definition . . . . . . . . . . . . . . 24
   11. Implementing Configuration Data Nodes  . . . . . . . . . . . . 27
     11.1. Example: addressMapControlTable of RMON2-MIB . . . . . . . 28
   12. IANA Considerations  . . . . . . . . . . . . . . . . . . . . . 30
   13. Security Considerations  . . . . . . . . . . . . . . . . . . . 30
   14. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 31
   15. References . . . . . . . . . . . . . . . . . . . . . . . . . . 31
     15.1. Normative References . . . . . . . . . . . . . . . . . . . 31
     15.2. Informative References . . . . . . . . . . . . . . . . . . 31
   Appendix A.  Mapping of Well-Known Types (Normative) . . . . . . . 33
   Appendix B.  Module Prefix Generation (Informative)  . . . . . . . 35
        
1. Introduction
1. 介绍

This document describes a translation of SMIv2 [RFC2578], [RFC2579], [RFC2580] MIB modules into YANG [RFC6020] modules, enabling read-only (config false, as defined in Section 7.19.1 of RFC 6020) access to SMIv2 objects defined in SMIv2 MIB modules via NETCONF [RFC6241]. For a discussion why SMIv2 read-write or read-create objects are translated to read-only (config false) YANG objects, see Section 11.

本文档描述了SMIv2[RFC2578]、[RFC2579]、[RFC2580]MIB模块到YANG[RFC6020]模块的转换,通过NETCONF[RFC6241]实现对SMIv2 MIB模块中定义的SMIv2对象的只读访问(配置错误,如RFC 6020第7.19.1节所定义)。有关SMIv2读写或读创建对象被转换为只读(config false)对象的原因的讨论,请参见第11节。

YANG modules generated from SMIv2 modules should not be modified. Any necessary changes should be made by modifying the original SMIv2 modules (with proper updates of the SMIv2 LAST-UPDATED and REVISION clauses) and then running the translation defined in this memo again. Note that this does not affect the usage of YANG augments and or YANG deviations: YANG modules generated from SMIv2 modules can be augmented like any other YANG module, and YANG deviations can be used to document how an implementation deviates from the generated YANG module.

不应修改由SMIv2模块生成的模块。应通过修改原始SMIv2模块(对SMIv2上次更新和修订条款进行适当更新),然后再次运行本备忘录中定义的翻译,来进行任何必要的更改。请注意,这并不影响YANG增强和/或YANG偏差的使用:从SMIv2模块生成的YANG模块可以像任何其他YANG模块一样进行增强,并且YANG偏差可以用于记录实现如何偏离生成的YANG模块。

SMIv1 modules can be converted to YANG by first following the rules in [RFC3584] to convert the SMIv1 module to SMIv2 and then following the rules in this document to convert the obtained SMIv2 module to YANG.

首先按照[RFC3584]中的规则将SMIv1模块转换为SMIv2,然后按照本文档中的规则将获得的SMIv2模块转换为YANG,即可将SMIv1模块转换为YANG。

The SMIv2-to-YANG mapping is illustrated by examples showing the translation of parts of the IF-MIB [RFC2863], the DIFFSERV-MIB [RFC3289], and the RMON2-MIB [RFC4502] SMIv2 modules.

SMIv2到YANG映射通过示例进行说明,示例显示了IF-MIB[RFC2863]、DIFFSERV-MIB[RFC3289]和RMON2-MIB[RFC4502]SMIv2模块的部分转换。

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

本文件中的关键词“必须”、“不得”、“必需”、“应”、“不应”、“建议”、“不建议”、“可”和“可选”应按照BCP 14[RFC2119]中的说明进行解释。

2. Mapping of Well-Known Types
2. 已知类型的映射

The SMIv2 base types and some well-known derived textual conventions are mapped to YANG types according to Appendix A. The mapping of the OCTET STRING depends on the context. If an OCTET STRING type has an associated DISPLAY-HINT, then the corresponding YANG base type is the string type. An implementation MUST format an OCTET STRING value according to the DISPLAY-HINT, as described in RFC 2579. If an OCTECT STRING type does not have an associated DISPLAY-HINT, the binary type is used. Similarly, the mapping of the INTEGER type depends on its usage as an enumeration or a 32-bit integral type. Implementations should provide implementation-specific options to handle situations where DISPLAY- HINTs are added during a revision of a module and backwards compatibility must be preserved, i.e., an added DISPLAY-HINT needs to be ignored.

SMIv2基类型和一些众所周知的派生文本约定根据附录A映射到YANG类型。八位字节字符串的映射取决于上下文。如果八位字节字符串类型具有关联的DISPLAY-HINT,则相应的基类型为字符串类型。实现必须根据DISPLAY-HINT格式化八位字节字符串值,如RFC2579中所述。如果八分位字符串类型没有关联的显示提示,则使用二进制类型。类似地,整数类型的映射取决于其作为枚举或32位整数类型的使用。实现应提供特定于实现的选项,以处理在模块修订期间添加显示提示且必须保留向后兼容性的情况,即需要忽略添加的显示提示。

The mappings shown in Appendix A may require to import the ietf-yang-types, ietf-inet-types, or ietf-yang-smiv2 YANG modules since some SMIv2 types and textual conventions map to YANG types defined in the ietf-yang-types and ietf-inet-types YANG modules defined in [RFC6021] and the ietf-yang-smiv2 YANG module defined in this document. Implementations MUST add any additional imports required by the type mapping.

附录A中显示的映射可能需要导入ietf yang类型、ietf inet类型或ietf-yang-smiv2 yang模块,因为一些smiv2类型和文本约定映射到[RFC6021]中定义的ietf yang类型和ietf inet类型yang模块中定义的yang类型和本文件中定义的ietf-yang-smiv2 yang模块。实现必须添加类型映射所需的任何其他导入。

3. Translation of SMIv2 Modules and SMIv2 IMPORT Clauses
3. SMIv2模块和SMIv2导入子句的翻译

SMIv2 modules are mapped to corresponding YANG modules. The generated YANG module name MUST be the same as the SMIv2 module name.

SMIv2模块映射到相应的模块。生成的模块名称必须与SMIv2模块名称相同。

The YANG namespace MUST be constructed out of the IANA-registered prefix urn:ietf:params:xml:ns:yang:smiv2: (see Section 12) followed by the SMIv2 module name. Since SMIv2 module names can be assumed to be unique (see Section 3 in [RFC2578]), the resulting YANG namespace is unique.

YANG名称空间必须由IANA注册前缀urn:ietf:params:xml:ns:YANG:smiv2:(参见第12节)和smiv2模块名构成。由于可以假定SMIv2模块名称是唯一的(请参见[RFC2578]中的第3节),因此生成的名称空间是唯一的。

The YANG prefix MAY be derived from the SMIv2 module name using the module prefix generation algorithm described in Appendix B. The YANG prefix is supposed to be short, and it must be unique within the set of all prefixes used by a YANG module. The algorithm described in Appendix B generates such prefixes.

YANG前缀可以使用附录B中描述的模块前缀生成算法从SMIv2模块名称中派生。YANG前缀应该很短,并且在YANG模块使用的所有前缀集中必须是唯一的。附录B中描述的算法生成这样的前缀。

SMIv2 IMPORT clauses are translated to YANG import statements. One major difference between the SMIv2 import mechanism and the YANG import mechanism is that SMIv2 IMPORT clauses import specific symbols from an SMIv2 module, while the YANG import statement imports all symbols of the referenced YANG module.

SMIv2导入子句被转换为导入语句。SMIv2导入机制和YANG导入机制之间的一个主要区别是,SMIv2导入子句从SMIv2模块导入特定符号,而YANG导入语句导入引用的YANG模块的所有符号。

In order to produce correct and complete YANG import statements, the following rules MUST be used:

为了生成正确完整的导入语句,必须使用以下规则:

o Process each item in each SMIv2 IMPORT clause as follows:

o 按如下方式处理每个SMIv2导入子句中的每个项目:

1. If an import statement for this SMIv2 module has already been generated, then ignore this item.

1. 如果已生成此SMIv2模块的导入语句,则忽略此项。

2. Otherwise, if the SMIv2 module name is SNMPv2-SMI or SNMPv2- CONF, then ignore this item. Note that these two modules can be completely ignored since all definitions in these modules are translated by translation rules.

2. 否则,如果SMIv2模块名为SNMPv2 SMI或SNMPv2-CONF,则忽略此项。请注意,这两个模块可以完全忽略,因为这些模块中的所有定义都是由翻译规则翻译的。

3. Otherwise, if this item is a textual convention matching one of the textual conventions in the SMIv2 types column of Appendix A (e.g., MacAddress, PhysAddress, or TimeStamp) then ignore this item.

3. 否则,如果此项是与附录a的SMIv2类型列中的一个文本约定相匹配的文本约定(例如MacAddress、PhysAddress或TimeStamp),则忽略此项。

4. Otherwise, if the item is used in a SYNTAX clause of an OBJECT-TYPE whose MAX-ACCESS is not accessible-for-notify, then generate an import statement as described below.

4. 否则,如果在对象类型的语法子句中使用了该项,而该对象类型的MAX-ACCESS对于notify是不可访问的,则生成如下所述的导入语句。

5. Otherwise, if the item is used in an OBJECTS clause of a NOTIFICATION-TYPE, then generate an import statement as described below.

5. 否则,如果在通知类型的OBJECTS子句中使用该项,则生成如下所述的导入语句。

6. Otherwise, if the item is used in an INDEX or AUGMENTS clause, then generate an import statement as described below.

6. 否则,如果在INDEX或AUGMENTS子句中使用该项,则生成如下所述的导入语句。

7. Otherwise, ignore this item. Some examples of this case are OBJECT IDENTIFIER assignments and objects that are only referenced in MODULE-COMPLIANCE, OBJECT-GROUP, or NOTIFICATION-GROUP clauses.

7. 否则,忽略此项。这种情况的一些示例是对象标识符分配和仅在MODULE-COMPLIANCE、OBJECT-GROUP或NOTIFICATION-GROUP子句中引用的对象。

o Generate any additional import statements as required by the type translations according to the type mapping table Appendix A. This requires the translator to consider all the types used in the SMIv2 module in order to produce the imports.

o 根据类型映射表附录A生成类型转换所需的任何附加导入语句。这需要翻译器考虑SMIV2模块中使用的所有类型,以便产生导入。

o Generate an import statement for the YANG module ietf-yang-smiv2 with the prefix smiv2.

o 为带有前缀smiv2的ietf-YANG-smiv2模块生成导入语句。

The generated import statements use the untranslated SMIv2 module names or the names of well-known YANG modules as their argument. The import statement must contain a prefix statement. The prefixes MAY be generated by applying the module prefix generation algorithm described in Appendix B.

生成的导入语句使用未翻译的SMIv2模块名或已知模块名作为其参数。导入语句必须包含前缀语句。可通过应用附录B中描述的模块前缀生成算法生成前缀。

3.1. Example: IMPORTS of IF-MIB
3.1. 示例:IF-MIB的导入

The translation of the IF-MIB [RFC2863] leads to the YANG module and namespace/prefix statement and the import statements shown below. The prefix is the translation of the SMIv2 module name IF-MIB to lowercase (consisting of two tokens and thus no further abbreviation).

IF-MIB[RFC2863]的翻译导致YANG模块和名称空间/前缀语句以及如下所示的导入语句。前缀是将SMIv2模块名IF-MIB翻译成小写(由两个标记组成,因此不再缩写)。

module IF-MIB {

模块IF-MIB{

       namespace "urn:ietf:params:xml:ns:yang:smiv2:IF-MIB";
       prefix "if-mib";
        
       namespace "urn:ietf:params:xml:ns:yang:smiv2:IF-MIB";
       prefix "if-mib";
        
       import IANAifType-MIB      { prefix "ianaiftype-mib"; }
       import SNMPv2-TC           { prefix "snmpv2-tc"; }
       import ietf-yang-types     { prefix "yang"; }
       import ietf-yang-smiv2     { prefix "smiv2"; }
     }
        
       import IANAifType-MIB      { prefix "ianaiftype-mib"; }
       import SNMPv2-TC           { prefix "snmpv2-tc"; }
       import ietf-yang-types     { prefix "yang"; }
       import ietf-yang-smiv2     { prefix "smiv2"; }
     }
        
4. Translation of the MODULE-IDENTITY Macro
4. 模块标识宏的翻译

SMIv2 requires an invocation of the MODULE-IDENTITY macro to provide contact and revision history for a MIB module. The clauses of the SMIv2 MODULE-IDENTITY macro MUST be translated into YANG statements as detailed below.

SMIv2需要调用MODULE-IDENTITY宏来提供MIB模块的联系和修订历史记录。SMIv2 MODULE-IDENTITY宏的子句必须翻译成以下详细说明的语句。

4.1. MODULE-IDENTITY Translation Rules
4.1. 模标识转换规则

o The SMIv2 ORGANIZATION clause is mapped to the YANG organization statement.

o SMIv2 ORGANIZATION子句映射到HONG ORGANIZATION语句。

o The SMIv2 CONTACT-INFO clause is mapped to the YANG contact statement.

o SMIv2 CONTACT-INFO子句映射到YANG CONTACT语句。

o The SMIv2 DESCRIPTION clause is mapped to the YANG description statement.

o SMIv2 DESCRIPTION子句映射到描述语句。

o Each SMIv2 REVISION clause is mapped to a YANG revision statement. The revision is identified by the date argument of the SMIv2 REVISION clause. DESCRIPTION sub-clauses of REVISION clauses are mapped to corresponding description statement nested in revision clauses.

o 每个SMIv2修订子句都映射到一个修订语句。版本由SMIv2修订条款的日期参数标识。修订条款的描述子条款映射到修订条款中嵌套的相应描述语句。

o The SMIv2 LAST-UPDATED clause is ignored if the associated date matches a REVISION clause. Otherwise, an additional revision statement is generated.

o 如果关联的日期与修订条款匹配,则忽略SMIv2 LAST-UPDATED子句。否则,将生成一个附加的修订声明。

o A top-level YANG container is generated. The container's name is the SMIv2 module name, and the container MUST be config false. The generation of the top-level container MAY be skipped if the SMIv2 module does not define any objects that go into the top-level container (e.g., an SMIv2 module only defining textual conventions).

o A top-level YANG container is generated. The container's name is the SMIv2 module name, and the container MUST be config false. The generation of the top-level container MAY be skipped if the SMIv2 module does not define any objects that go into the top-level container (e.g., an SMIv2 module only defining textual conventions).translate error, please retry

o The object identifier value of the invocation of the SMIv2 MODULE-IDENTITY is translated into an smiv2:oid statement contained in an smiv2:alias statement representing the MODULE-IDENTITY macro invocation. Refer to the YANG extension defined in Section 10.

o SMIv2 MODULE-IDENTITY调用的对象标识符值被转换为包含在表示MODULE-IDENTITY宏调用的SMIv2:alias语句中的SMIv2:oid语句。参考第10节中定义的阳延伸。

While all proper SMIv2 modules must have exactly one MODULE-IDENTITY macro invocation, there are a few notable exceptions. The modules defining the SMIv2 language (i.e., the SNMPv2-SMI, SNMPv2-TC, and SNMPv2-CONF modules) do not invoke the MODULE-IDENTITY macro. Furthermore, SMIv2 modules generated from SMIv1 modules may miss an invocation of the MODULE-IDENTITY macro as well. In such cases, it is preferable to not generate organization, contact, description, or revision statements.

虽然所有正确的SMIv2模块必须只有一个MODULE-IDENTITY宏调用,但也有一些值得注意的例外。定义SMIv2语言的模块(即SNMPv2 SMI、SNMPv2 TC和SNMPv2 CONF模块)不调用MODULE-IDENTITY宏。此外,从SMIv1模块生成的SMIv2模块也可能会错过对MODULE-IDENTITY宏的调用。在这种情况下,最好不要生成组织、联系人、描述或修订声明。

4.2. Example: MODULE-IDENTITY of IF-MIB
4.2. 示例:IF-MIB的模块标识

The translation of the MODULE-IDENTITY of the IF-MIB [RFC2863] leads to the following YANG statements:

IF-MIB[RFC2863]模块标识的翻译导致以下陈述:

organization "IETF Interfaces MIB Working Group";

组织“IETF接口MIB工作组”;

contact "Keith McCloghrie Cisco Systems, Inc. 170 West Tasman Drive San Jose, CA 95134-1706 US

联系“美国加利福尼亚州圣何塞西塔斯曼大道170号Keith McCloghrie Cisco Systems,Inc.,邮编95134-1706

408-526-5260 kzm@cisco.com";

408-526-5260 kzm@cisco.com";

description "The MIB module to describe generic objects for network interface sub-layers. This MIB is an updated version of MIB-II's ifTable, and incorporates the extensions defined in RFC 1229.";

description“用于描述网络接口子层的通用对象的MIB模块。此MIB是MIB-II ifTable的更新版本,并包含RFC 1229中定义的扩展。”;

     revision "2000-06-14" {
       description
        "Clarifications agreed upon by the Interfaces MIB WG, and
         published as RFC 2863.";
     }
     revision "1996-02-28" {
       description
        "Revisions made by the Interfaces MIB WG, and published in
         RFC 2233.";
     }
     revision "1993-11-08" {
       description
        "Initial revision, published as part of RFC 1573.";
     }
        
     revision "2000-06-14" {
       description
        "Clarifications agreed upon by the Interfaces MIB WG, and
         published as RFC 2863.";
     }
     revision "1996-02-28" {
       description
        "Revisions made by the Interfaces MIB WG, and published in
         RFC 2233.";
     }
     revision "1993-11-08" {
       description
        "Initial revision, published as part of RFC 1573.";
     }
        
     container IF-MIB {
       config false;
     }
        
     container IF-MIB {
       config false;
     }
        
5. Translation of the TEXTUAL-CONVENTION Macro
5. 文本约定宏的翻译

The SMIv2 uses invocations of the TEXTUAL-CONVENTION macro to define new types derived from the SMIv2 base types. Invocations of the TEXTUAL-CONVENTION macro MUST be translated into YANG typedef statements as detailed below.

SMIv2使用文本约定宏的调用来定义从SMIv2基类型派生的新类型。text-CONVENTION宏的调用必须转换为下面详述的typedef语句。

5.1. TEXTUAL-CONVENTION Translation Rules
5.1. 文本约定翻译规则

The name of the TEXTUAL-CONVENTION macro invocation is used as the name of the generated typedef statement. The clauses of the SMIv2 TEXTUAL-CONVENTION macro are mapped to YANG statements embedded in the typedef statement as follows:

文本约定宏调用的名称用作生成的typedef语句的名称。SMIv2文本约定宏的子句映射到typedef语句中嵌入的语句,如下所示:

o The SMIv2 DISPLAY-HINT clause is used to determine the type mapping of types derived form the OCTET STRING type as explained in Section 2. Furthermore, the DISPLAY-HINT value MAY be used to generate a regular expression for the YANG pattern statement within the type statement.

o SMIv2 DISPLAY-HINT子句用于确定从八进制字符串类型派生的类型的类型映射,如第2节所述。此外,DISPLAY-HINT值可用于在type语句中为YANG模式语句生成正则表达式。

o The SMIv2 DISPLAY-HINT is translated into an smiv2:display-hint statement. Refer to the YANG extension defined in Section 10.

o SMIv2 DISPLAY-HINT被转换为SMIv2:DISPLAY-HINT语句。参考第10节中定义的阳延伸。

o The SMIv2 STATUS clause is mapped to the YANG status statement. The generation of the YANG status statement is skipped if the value of the STATUS clause is current.

o SMIv2 STATUS子句映射到YANG STATUS语句。如果status子句的值为current,则跳过状态语句的生成。

o The SMIv2 DESCRIPTION clause is mapped to the YANG description statement.

o SMIv2 DESCRIPTION子句映射到描述语句。

o The SMIv2 REFERENCE clause is mapped to the YANG reference statement.

o SMIv2引用子句映射到YANG引用语句。

o The SMIv2 SYNTAX clause is mapped to the YANG type statement. SMIv2 range restrictions are mapped to YANG range statements, while SMIv2 length restrictions are mapped to YANG length statements. SMIv2 INTEGER enumerations are mapped to YANG enum/ value statements. SMIv2 BITS are mapped to YANG bit/position statements. For OCTET STRING types that are mapped to a YANG string base type (see Section 2), the length specified in the YANG length statement must be consistent with the stringified representation of values. If an implementation is unable to derive a proper length restrictions, then the YANG length statement MUST be omitted.

o SMIv2语法子句映射到YANG类型语句。SMIv2范围限制映射到YANG范围语句,而SMIv2长度限制映射到YANG长度语句。SMIv2整数枚举映射到enum/value语句。SMIv2位映射到YANG位/位置语句。对于映射到YANG字符串基类型的八位组字符串类型(参见第2节),YANG-length语句中指定的长度必须与值的字符串化表示一致。如果实现无法派生适当的长度限制,则必须省略YANG-length语句。

This translation assumes that labels of named numbers and named bits do not change when an SMIv2 module is revised. This is consistent with the clarification of the SMIv2 module revision rules in Section 4.9 of [RFC4181].

此转换假定修订SMIv2模块时,命名数字和命名位的标签不会更改。这与[RFC4181]第4.9节中SMIv2模块修订规则的澄清一致。

5.2. Example: OwnerString and InterfaceIndex of IF-MIB
5.2. 示例:IF-MIB的OwnerString和InterfaceIndex

The translations of the OwnerString and InterfaceIndex textual conventions of the IF-MIB [RFC2863] are shown below.

IF-MIB[RFC2863]的OwnerString和InterfaceIndex文本约定的翻译如下所示。

     typedef OwnerString {
       type string {
         length "0..255";
         pattern '\p{IsBasicLatin}{0,255}';
       }
       status deprecated;
       description
        "This data type is used to model an administratively
         assigned name of the owner of a resource.  This information
         is taken from the NVT ASCII character set.  It is suggested
         that this name contain one or more of the following: ASCII
         form of the manager station's transport address, management
         station name (e.g., domain name), network management
         personnel's name, location, or phone number.  In some cases
         the agent itself will be the owner of an entry.  In these
         cases, this string shall be set to a string starting with
         'agent'.";
       smiv2:display-hint "255a";
     }
        
     typedef OwnerString {
       type string {
         length "0..255";
         pattern '\p{IsBasicLatin}{0,255}';
       }
       status deprecated;
       description
        "This data type is used to model an administratively
         assigned name of the owner of a resource.  This information
         is taken from the NVT ASCII character set.  It is suggested
         that this name contain one or more of the following: ASCII
         form of the manager station's transport address, management
         station name (e.g., domain name), network management
         personnel's name, location, or phone number.  In some cases
         the agent itself will be the owner of an entry.  In these
         cases, this string shall be set to a string starting with
         'agent'.";
       smiv2:display-hint "255a";
     }
        
     typedef InterfaceIndex {
       type int32 {
         range "1..2147483647";
       }
       description
        "A unique value, greater than zero, for each interface or
         interface sub-layer in the managed system.  It is
         recommended that values are assigned contiguously starting
         from 1.  The value for each interface sub-layer must remain
         constant at least from one re-initialization of the entity's
         network management system to the next re-initialization.";
       smiv2:display-hint "d";
     }
        
     typedef InterfaceIndex {
       type int32 {
         range "1..2147483647";
       }
       description
        "A unique value, greater than zero, for each interface or
         interface sub-layer in the managed system.  It is
         recommended that values are assigned contiguously starting
         from 1.  The value for each interface sub-layer must remain
         constant at least from one re-initialization of the entity's
         network management system to the next re-initialization.";
       smiv2:display-hint "d";
     }
        
5.3. Example: IfDirection of the DIFFSERV-MIB
5.3. 示例:DIFFSERV-MIB的方向

The translation of the IfDirection textual convention of the DIFFSERV-MIB [RFC3289] is shown below.

DIFFSERV-MIB[RFC3289]的文本约定的翻译如下所示。

     typedef IfDirection {
       type enumeration {
         enum inbound  { value 1; }
         enum outbound { value 2; }
       }
       description
        "IfDirection specifies a direction of data travel on an
         interface. 'inbound' traffic is operated on during reception
         from the interface, while 'outbound' traffic is operated on
         prior to transmission on the interface.";
     }
        
     typedef IfDirection {
       type enumeration {
         enum inbound  { value 1; }
         enum outbound { value 2; }
       }
       description
        "IfDirection specifies a direction of data travel on an
         interface. 'inbound' traffic is operated on during reception
         from the interface, while 'outbound' traffic is operated on
         prior to transmission on the interface.";
     }
        
6. Translation of OBJECT IDENTIFIER Assignments
6. 对象标识符赋值的转换

The SMIv2 uses OBJECT IDENTIFIER assignments to introduce names for intermediate nodes in the OBJECT IDENTIFIER tree. OBJECT IDENTIFIER assignments are translated into smiv2:alias statements. Refer to the YANG extension defined in Section 10.

SMIv2使用对象标识符分配为对象标识符树中的中间节点引入名称。对象标识符分配转换为smiv2:alias语句。参考第10节中定义的阳延伸。

7. Translation of the OBJECT-TYPE Macro
7. 对象类型宏的转换

The SMIv2 uses the OBJECT-TYPE macro to define objects and the structure of conceptual tables. Objects exist either as scalars (exactly one instance within an SNMP context) or columnar objects within conceptual tables (zero or multiple instances within an SNMP context). A number of auxiliary objects define the index (key) of a conceptual table. Furthermore, conceptual tables can be augmented by other conceptual tables. All these differences must be taken into account when translating SMIv2 OBJECT-TYPE macro invocations to YANG. Invocations of the OBJECT-TYPE macro MUST be translated into YANG statements as detailed below.

SMIv2使用对象类型宏定义对象和概念表的结构。对象既可以作为标量(SNMP上下文中只有一个实例)存在,也可以作为概念表中的列对象存在(SNMP上下文中有零个或多个实例)。许多辅助对象定义概念表的索引(键)。此外,概念表可以由其他概念表扩充。在将SMIv2对象类型宏调用转换为YANG时,必须考虑所有这些差异。必须将对象类型宏的调用转换为以下详细说明的语句。

7.1. Scalar and Columnar Object Translation Rules
7.1. 标量和列对象转换规则

SMIv2 OBJECT-TYPE macro invocations defining scalars or columnar objects with a MAX-ACCESS of "not-accessible", "read-only", "read-write", and "read-create" are translated to YANG leaf statements. Additionally, columnar objects with a MAX-ACCESS of "accessible-for-notify" are translated to YANG leaf statements if that columnar object is part of the INDEX clause of the table containing that columnar object. The name of the leaf is the name associated with the SMIv2 OBJECT-TYPE macro invocation. SMIv2 OBJECT-TYPE macro invocations with a MAX-ACCESS of

SMIv2对象类型宏调用定义了最大访问权限为“不可访问”、“只读”、“读写”和“读创建”的标量或列对象,这些宏调用被转换为YANG-leaf语句。此外,如果列对象是包含该列对象的表的INDEX子句的一部分,则MAX-ACCESS为“accessible for notify”的列对象将转换为YANG-leaf语句。叶的名称是与SMIv2对象类型宏调用关联的名称。最大访问权限为的SMIv2对象类型宏调用

"accessible-for-notify" are not translated to YANG data tree leafs but instead are translated into YANG notification leafs.

“可访问通知”不会转换为YANG数据树叶,而是转换为YANG通知叶。

Leaf statements for scalar objects are created in a container representing the scalar's parent node in the OID tree. This container is named after the scalar's parent node in the OID tree and placed in the top-level container representing the SMIv2 module; see Section 4.1. In the rare case that the scalar's parent node has multiple names, the automatic translation MUST fail with an error, and the name clash needs to be investigated and fixed manually. In case a previous revision of the SMIv2 module did not have an ambiguity, then the name used by the previous revision MUST be used. The leaf statements representing columnar objects are created in the list representing a conceptual row; see Section 7.3.

标量对象的叶语句是在表示OID树中标量的父节点的容器中创建的。该容器以OID树中标量的父节点命名,并放置在表示SMIv2模块的顶级容器中;见第4.1节。在标量的父节点具有多个名称的罕见情况下,自动转换必须失败并出现错误,并且需要手动调查和修复名称冲突。如果以前版本的SMIv2模块没有歧义,则必须使用以前版本使用的名称。在表示概念行的列表中创建表示列对象的叶语句;见第7.3节。

o The SMIv2 SYNTAX clause is mapped to the YANG type statement. SMIv2 range restrictions are mapped to YANG range statements, while SMIv2 length restrictions are mapped to YANG length statements. SMIv2 INTEGER enumerations are mapped to YANG enum/ value statements. SMIv2 BITS are mapped to YANG bit/position statements. For OCTET STRING types that are mapped to a YANG string base type (see Section 2), the length specified in the YANG length statement must be consistent with the stringified representation of values. If an implementation is unable to derive proper length restrictions, then the YANG length statement MUST be omitted.

o SMIv2语法子句映射到YANG类型语句。SMIv2范围限制映射到YANG范围语句,而SMIv2长度限制映射到YANG长度语句。SMIv2整数枚举映射到enum/value语句。SMIv2位映射到YANG位/位置语句。对于映射到YANG字符串基类型的八位组字符串类型(参见第2节),YANG-length语句中指定的长度必须与值的字符串化表示一致。如果实现无法派生适当的长度限制,则必须省略YANG-length语句。

o The SMIv2 UNITS clause is mapped to the YANG units statement.

o SMIv2 UNITS子句映射到YANG UNITS语句。

o The SMIv2 MAX-ACCESS is translated into an smiv2:max-access statement. Refer to the YANG extension defined in Section 10.

o SMIv2 MAX-ACCESS被转换为SMIv2:MAX-ACCESS语句。参考第10节中定义的阳延伸。

o The SMIv2 STATUS clause is mapped to the YANG status statement. The generation of the YANG status statement is skipped if the value of the STATUS clause is current.

o SMIv2 STATUS子句映射到YANG STATUS语句。如果status子句的值为current,则跳过状态语句的生成。

o The SMIv2 DESCRIPTION clause is mapped to the YANG description statement.

o SMIv2 DESCRIPTION子句映射到描述语句。

o The SMIv2 REFERENCE clause is mapped to the YANG reference statement.

o SMIv2引用子句映射到YANG引用语句。

o The SMIv2 DEFVAL clause is mapped to an smiv2:defval statement. Refer to the YANG extension defined in Section 10.

o SMIv2 DEFVAL子句映射到SMIv2:DEFVAL语句。参考第10节中定义的阳延伸。

o The value of the SMIv2 OBJECT-TYPE macro invocation is translated into an smiv2:oid statement. Refer to the YANG extension defined in Section 10.

o SMIv2对象类型宏调用的值被转换为SMIv2:oid语句。参考第10节中定义的阳延伸。

This translation assumes that labels of named numbers and named bits do not change when an SMIv2 module is revised. This is consistent with the clarification of the SMIv2 module revision rules in Section 4.9 of [RFC4181].

此转换假定修订SMIv2模块时,命名数字和命名位的标签不会更改。这与[RFC4181]第4.9节中SMIv2模块修订规则的澄清一致。

7.2. Example: ifNumber and ifIndex of the IF-MIB
7.2. 示例:IF-MIB的ifNumber和ifIndex

The translations of the ifNumber scalar object and the ifIndex columnar object of the IF-MIB [RFC2863] are shown below. Since ifNumber is a scalar object in the interfaces branch of the IF-MIB, the YANG leaf ifNumber will be placed in a YANG container called interfaces, which is registered in the top-level container IF-MIB.

IF-MIB[RFC2863]的ifNumber标量对象和ifIndex列对象的转换如下所示。由于ifNumber是IF-MIB接口分支中的标量对象,因此YANG-leaf ifNumber将放置在名为interfaces的YANG容器中,该容器注册在顶级容器IF-MIB中。

     leaf ifNumber {
       type int32;
       description
        "The number of network interfaces (regardless of their
         current state) present on this system.";
       smiv2:max-access "read-only";
       smiv2:oid "1.3.6.1.2.1.2.1";
     }
        
     leaf ifNumber {
       type int32;
       description
        "The number of network interfaces (regardless of their
         current state) present on this system.";
       smiv2:max-access "read-only";
       smiv2:oid "1.3.6.1.2.1.2.1";
     }
        
     leaf ifIndex {
       type if-mib:InterfaceIndex;
       description
        "A unique value, greater than zero, for each interface.  It
         is recommended that values are assigned contiguously
         starting from 1.  The value for each interface sub-layer
         must remain constant at least from one re-initialization of
         the entity's network management system to the next re-
         initialization.";
       smiv2:max-access "read-only";
       smiv2:oid "1.3.6.1.2.1.2.2.1.1";
     }
        
     leaf ifIndex {
       type if-mib:InterfaceIndex;
       description
        "A unique value, greater than zero, for each interface.  It
         is recommended that values are assigned contiguously
         starting from 1.  The value for each interface sub-layer
         must remain constant at least from one re-initialization of
         the entity's network management system to the next re-
         initialization.";
       smiv2:max-access "read-only";
       smiv2:oid "1.3.6.1.2.1.2.2.1.1";
     }
        
7.3. Non-Augmenting Conceptual Table Translation Rules
7.3. 非增广概念表转换规则

An OBJECT-TYPE macro invocation defining a non-augmenting conceptual table is translated to a YANG container statement using the name of the OBJECT-TYPE macro invocation. This container is created in the top-level container representing the SMIv2 module. The clauses of the macro are translated as follows:

定义非扩充概念表的对象类型宏调用使用对象类型宏调用的名称转换为YANG容器语句。此容器是在表示SMIv2模块的顶级容器中创建的。宏的条款翻译如下:

o The SMIv2 SYNTAX clause is ignored

o 忽略SMIv2语法子句

o The SMIv2 UNITS clause is ignored.

o 忽略SMIv2 UNITS子句。

o The SMIv2 MAX-ACCESS clause is ignored.

o 忽略SMIv2 MAX-ACCESS子句。

o The SMIv2 STATUS clause is mapped to the YANG status statement. The generation of the YANG status statement is skipped if the value of the STATUS clause is current.

o SMIv2 STATUS子句映射到YANG STATUS语句。如果status子句的值为current,则跳过状态语句的生成。

o The SMIv2 DESCRIPTION clause is mapped to the YANG description statement.

o SMIv2 DESCRIPTION子句映射到描述语句。

o The SMIv2 REFERENCE clause is mapped to the YANG reference statement.

o SMIv2引用子句映射到YANG引用语句。

o The value of the SMIv2 OBJECT-TYPE macro invocation is translated into an smiv2:oid statement. Refer to the YANG extension defined in Section 10.

o SMIv2对象类型宏调用的值被转换为SMIv2:oid语句。参考第10节中定义的阳延伸。

An OBJECT-TYPE macro invocation defining a conceptual row is translated to a YANG list statement. It is contained in the YANG container representing the conceptual table. The generated list uses the name of the row OBJECT-TYPE macro invocation. The clauses of the OBJECT-TYPE macro are translated as follows:

定义概念行的对象类型宏调用被转换为YANG list语句。它包含在表示概念表的容器中。生成的列表使用行对象类型宏调用的名称。对象类型宏的子句翻译如下:

o The SMIv2 SYNTAX clause is ignored.

o 忽略SMIv2语法子句。

o The SMIv2 UNITS clause is ignored.

o 忽略SMIv2 UNITS子句。

o The SMIv2 MAX-ACCESS clause is ignored.

o 忽略SMIv2 MAX-ACCESS子句。

o The SMIv2 STATUS clause is mapped to the YANG status statement. The generation of the YANG status statement is skipped if the value of the STATUS clause is current.

o SMIv2 STATUS子句映射到YANG STATUS语句。如果status子句的值为current,则跳过状态语句的生成。

o The SMIv2 DESCRIPTION clause is mapped to the YANG description statement.

o SMIv2 DESCRIPTION子句映射到描述语句。

o The SMIv2 REFERENCE clause is mapped to the YANG reference statement.

o SMIv2引用子句映射到YANG引用语句。

o The SMIv2 INDEX clause is mapped to the YANG key clause listing the columnar objects forming the key of the YANG list. If the same object appears more than once in the INDEX clause, append '_<n>' to the duplicate object name(s) where '<n>' counts the occurrences of the object in the INDEX clause, starting from 2. Additional leaf statements must be created to define the leafs introduced.

o SMIv2 INDEX子句映射到YANG key子句,列出构成YANG列表键的列对象。如果同一对象在INDEX子句中出现多次,请在重复对象名称后附加“\n>”,其中“<n>”从2开始计算INDEX子句中对象的出现次数。必须创建附加的leaf语句来定义引入的leaf。

o If the SMIv2 INDEX clause contains the IMPLIED keyword, then an smiv2:implied statement is generated to record the name of the object preceded by the IMPLIED keyword. Refer to the YANG extension defined in Section 10.

o 如果SMIv2 INDEX子句包含隐含关键字,则会生成一条SMIv2:implicated语句来记录在隐含关键字前面的对象名称。参考第10节中定义的阳延伸。

o The value of the SMIv2 OBJECT-TYPE macro invocation is translated into an smiv2:oid statement. Refer to the YANG extension defined in Section 10.

o SMIv2对象类型宏调用的值被转换为SMIv2:oid语句。参考第10节中定义的阳延伸。

Within the list statement, YANG leaf statements are created for columnar objects as described in Section 7.1. For objects listed in the SMIv2 INDEX clause that are not part of the conceptual table itself, YANG leaf statements of type leafref pointing to the referenced definition are created.

在list语句中,如第7.1节所述,为柱状对象创建了YANG-leaf语句。对于SMIv2 INDEX子句中列出的不属于概念表本身的对象,将创建指向引用定义的leafref类型的leafref语句。

7.4. Example: ifTable of the IF-MIB
7.4. 示例:IF-MIB的ifTable

The translation of the definition of the ifTable of the IF-MIB [RFC2863] is shown below.

IF-MIB[RFC2863]的ifTable定义的翻译如下所示。

     container ifTable {
       description
        "A list of interface entries.  The number of entries is
         given by the value of ifNumber.";
       smiv2:oid "1.3.6.1.2.1.2.2";
        
     container ifTable {
       description
        "A list of interface entries.  The number of entries is
         given by the value of ifNumber.";
       smiv2:oid "1.3.6.1.2.1.2.2";
        
       list ifEntry {
         key "ifIndex";
         description
          "An entry containing management information applicable to a
           particular interface.";
         smiv2:oid "1.3.6.1.2.1.2.2.1";
        
       list ifEntry {
         key "ifIndex";
         description
          "An entry containing management information applicable to a
           particular interface.";
         smiv2:oid "1.3.6.1.2.1.2.2.1";
        
         leaf ifIndex {
           type if-mib:InterfaceIndex;
           description
            "A unique value, greater than zero, for each interface.  It
             is recommended that values are assigned contiguously
             starting from 1.  The value for each interface sub-layer
             must remain constant at least from one re-initialization of
             the entity's network management system to the next re-
             initialization.";
           smiv2:max-access "read-only";
           smiv2:oid "1.3.6.1.2.1.2.2.1.1";
         }
        
         leaf ifIndex {
           type if-mib:InterfaceIndex;
           description
            "A unique value, greater than zero, for each interface.  It
             is recommended that values are assigned contiguously
             starting from 1.  The value for each interface sub-layer
             must remain constant at least from one re-initialization of
             the entity's network management system to the next re-
             initialization.";
           smiv2:max-access "read-only";
           smiv2:oid "1.3.6.1.2.1.2.2.1.1";
         }
        
         // ...
       }
     }
        
         // ...
       }
     }
        
7.5. Example: ifRcvAddressTable of the IF-MIB
7.5. 示例:IF-MIB的ifRcvAddressTable

The translation of the definition of the ifRcvAddressTable of the IF-MIB [RFC2863] is shown below.

IF-MIB[RFC2863]的IFRCVAAddressTable定义的翻译如下所示。

container ifRcvAddressTable { description "This table contains an entry for each address (broadcast, multicast, or uni-cast) for which the system will receive packets/frames on a particular interface, except as follows:

container ifRcvAddressTable{description“此表包含系统将在特定接口上接收数据包/帧的每个地址(广播、多播或uni-cast)的条目,以下情况除外:

- for an interface operating in promiscuous mode, entries are only required for those addresses for which the system would receive frames were it not operating in promiscuous mode.

- 对于在混杂模式下运行的接口,只有在系统未在混杂模式下运行的情况下接收帧的地址才需要输入项。

- for 802.5 functional addresses, only one entry is required, for the address which has the functional address bit ANDed with the bit mask of all functional addresses for which the interface will accept frames.

- 对于802.5功能地址,对于具有功能地址位且带有接口将接受帧的所有功能地址的位掩码的地址,只需要一个条目。

         A system is normally able to use any unicast address which
         corresponds to an entry in this table as a source address.";
       smiv2:oid "1.3.6.1.2.1.31.1.4";
        
         A system is normally able to use any unicast address which
         corresponds to an entry in this table as a source address.";
       smiv2:oid "1.3.6.1.2.1.31.1.4";
        
       list ifRcvAddressEntry {
         key "ifIndex ifRcvAddressAddress";
         description
          "A list of objects identifying an address for which the
           system will accept packets/frames on the particular
           interface identified by the index value ifIndex.";
         smiv2:oid "1.3.6.1.2.1.31.1.4.1";
        
       list ifRcvAddressEntry {
         key "ifIndex ifRcvAddressAddress";
         description
          "A list of objects identifying an address for which the
           system will accept packets/frames on the particular
           interface identified by the index value ifIndex.";
         smiv2:oid "1.3.6.1.2.1.31.1.4.1";
        
         leaf ifIndex {
           type leafref {
             path "/if-mib:IF-MIB/if-mib:ifTable" +
                  "/if-mib:ifEntry/if-mib:ifIndex";
           }
         }
        
         leaf ifIndex {
           type leafref {
             path "/if-mib:IF-MIB/if-mib:ifTable" +
                  "/if-mib:ifEntry/if-mib:ifIndex";
           }
         }
        
         leaf ifRcvAddressAddress {
           type yang:phys-address;
           description
            "An address for which the system will accept packets/frames
             on this entry's interface.";
           smiv2:max-access "not-accessible";
           smiv2:oid "1.3.6.1.2.1.31.1.4.1.1";
         }
        
         leaf ifRcvAddressAddress {
           type yang:phys-address;
           description
            "An address for which the system will accept packets/frames
             on this entry's interface.";
           smiv2:max-access "not-accessible";
           smiv2:oid "1.3.6.1.2.1.31.1.4.1.1";
         }
        
         // ...
       }
     }
        
         // ...
       }
     }
        
7.6. Example: alHostTable of the RMON2-MIB
7.6. 示例:RMON2-MIB的alHostTable

The translation of the definition of the alHostTable of the RMON2-MIB [RFC4502] is shown below.

RMON2-MIB[RFC4502]的alHostTable定义的翻译如下所示。

container alHostTable { description "A collection of statistics for a particular protocol from a particular network address that has been discovered on an interface of this device.

容器alHostTable{description“在该设备的接口上发现的来自特定网络地址的特定协议的统计信息的集合。

The probe will populate this table for all protocols in the protocol directory table whose value of protocolDirHostConfig is equal to supportedOn(3), and will delete any entries whose protocolDirEntry is deleted or has a protocolDirHostConfig value of supportedOff(2).

探测器将为protocolDirHostConfig值等于supportedOn(3)的协议目录表中的所有协议填充此表,并将删除protocolDirEntry已删除或protocolDirHostConfig值为supportedOff(2)的任何条目。

       The probe will add to this table all addresses
       seen as the source or destination address in all packets with
       no MAC errors and will increment octet and packet counts in
       the table for all packets with no MAC errors.  Further,
       entries will only be added to this table if their address
       exists in the nlHostTable and will be deleted from this table
       if their address is deleted from the nlHostTable.";
     smiv2:oid "1.3.6.1.2.1.16.16.1";
        
       The probe will add to this table all addresses
       seen as the source or destination address in all packets with
       no MAC errors and will increment octet and packet counts in
       the table for all packets with no MAC errors.  Further,
       entries will only be added to this table if their address
       exists in the nlHostTable and will be deleted from this table
       if their address is deleted from the nlHostTable.";
     smiv2:oid "1.3.6.1.2.1.16.16.1";
        
     list alHostEntry {
       key "hlHostControlIndex alHostTimeMark protocolDirLocalIndex "
         + "nlHostAddress protocolDirLocalIndex_2";
       description
        "A conceptual row in the alHostTable.
        
     list alHostEntry {
       key "hlHostControlIndex alHostTimeMark protocolDirLocalIndex "
         + "nlHostAddress protocolDirLocalIndex_2";
       description
        "A conceptual row in the alHostTable.
        

The hlHostControlIndex value in the index identifies the hlHostControlEntry on whose behalf this entry was created. The first protocolDirLocalIndex value in the index identifies the network-layer protocol of the address. The nlHostAddress value in the index identifies the network-layer address of this entry. The second protocolDirLocalIndex value in the index identifies the protocol that is counted by this entry.

索引中的hlHostControlIndex值标识代表其创建此项的hlHostControlEntry。索引中的第一个ProtocolDirLocaliIndex值标识地址的网络层协议。索引中的nlHostAddress值标识此项的网络层地址。索引中的第二个ProtocolDirLocaliIndex值标识由该条目计数的协议。

An example of the indexing in this entry is alHostOutPkts.1.783495.18.4.128.2.6.6.34.

本条目的索引示例为alHostOutPkts.1.783495.18.4.128.2.6.6.34。

         Note that some combinations of index values may result in an
         index that exceeds 128 sub-identifiers in length, which exceeds
         the maximum for the SNMP protocol.  Implementations should take
         care to avoid such combinations.";
       smiv2:oid "1.3.6.1.2.1.16.16.1.1";
        
         Note that some combinations of index values may result in an
         index that exceeds 128 sub-identifiers in length, which exceeds
         the maximum for the SNMP protocol.  Implementations should take
         care to avoid such combinations.";
       smiv2:oid "1.3.6.1.2.1.16.16.1.1";
        

// ...

// ...

       leaf protocolDirLocalIndex {
         type leafref {
           path "/rmon2-mib:RMON2-MIB/"
              + "rmon2-mib:protocolDirTable/"
              + "rmon2-mib:protocolDirEntry/"
              + "rmon2-mib:protocolDirLocalIndex";
         }
       }
        
       leaf protocolDirLocalIndex {
         type leafref {
           path "/rmon2-mib:RMON2-MIB/"
              + "rmon2-mib:protocolDirTable/"
              + "rmon2-mib:protocolDirEntry/"
              + "rmon2-mib:protocolDirLocalIndex";
         }
       }
        

// ...

// ...

       leaf protocolDirLocalIndex_2 {
         type leafref {
           path "/rmon2-mib:RMON2-MIB/"
              + "rmon2-mib:protocolDirTable/"
              + "rmon2-mib:protocolDirEntry/"
              + "rmon2-mib:protocolDirLocalIndex";
         }
       }
        
       leaf protocolDirLocalIndex_2 {
         type leafref {
           path "/rmon2-mib:RMON2-MIB/"
              + "rmon2-mib:protocolDirTable/"
              + "rmon2-mib:protocolDirEntry/"
              + "rmon2-mib:protocolDirLocalIndex";
         }
       }
        
       // ...
     }
   }
        
       // ...
     }
   }
        
7.7. Augmenting Conceptual Tables Translation Rules
7.7. 扩充概念表翻译规则

An OBJECT-TYPE macro invocation defining an augmenting conceptual table is translated to a YANG smiv2:alias statement. Refer to the YANG extension defined in Section 10. The clauses of the macro are translated as follows:

定义扩充概念表的对象类型宏调用被转换为一个smiv2:alias语句。参考第10节中定义的阳延伸。宏的条款翻译如下:

o The SMIv2 SYNTAX clause is ignored.

o 忽略SMIv2语法子句。

o The SMIv2 UNITS clause is ignored.

o 忽略SMIv2 UNITS子句。

o The SMIv2 MAX-ACCESS clause is ignored.

o 忽略SMIv2 MAX-ACCESS子句。

o The SMIv2 STATUS clause is mapped to the YANG status statement. The generation of the YANG status statement is skipped if the value of the STATUS clause is current.

o SMIv2 STATUS子句映射到YANG STATUS语句。如果status子句的值为current,则跳过状态语句的生成。

o The SMIv2 DESCRIPTION clause is mapped to the YANG description statement.

o SMIv2 DESCRIPTION子句映射到描述语句。

o The SMIv2 REFERENCE clause is mapped to the YANG reference statement.

o SMIv2引用子句映射到YANG引用语句。

o The value of the SMIv2 OBJECT-TYPE macro invocation is translated into an smiv2:oid statement. Refer to the YANG extension defined in Section 10.

o SMIv2对象类型宏调用的值被转换为SMIv2:oid语句。参考第10节中定义的阳延伸。

An OBJECT-TYPE macro invocation defining a conceptual row augmentation is translated to a YANG smiv2:alias statement and a YANG augment statement using the path to the augmented table as its argument. The clauses of the OBJECT-TYPE macro are translated as follows:

定义概念行扩充的对象类型宏调用被转换为YANG smiv2:alias语句和使用扩充表路径作为参数的YANG augment语句。对象类型宏的子句翻译如下:

o The SMIv2 SYNTAX clause is ignored.

o 忽略SMIv2语法子句。

o The SMIv2 UNITS clause is ignored.

o 忽略SMIv2 UNITS子句。

o The SMIv2 MAX-ACCESS clause is ignored.

o 忽略SMIv2 MAX-ACCESS子句。

o The SMIv2 STATUS clause is mapped to the YANG status statement. The generation of the YANG status statement is skipped if the value of the STATUS clause is current.

o SMIv2 STATUS子句映射到YANG STATUS语句。如果status子句的值为current,则跳过状态语句的生成。

o The SMIv2 DESCRIPTION clause is mapped to the YANG description statement.

o SMIv2 DESCRIPTION子句映射到描述语句。

o The SMIv2 REFERENCE clause is mapped to the YANG reference statement.

o SMIv2引用子句映射到YANG引用语句。

o The value of the SMIv2 OBJECT-TYPE macro invocation is translated into an smiv2:oid statement. Refer to the YANG extension defined in Section 10.

o SMIv2对象类型宏调用的值被转换为SMIv2:oid语句。参考第10节中定义的阳延伸。

Within the augment statement, YANG leaf statements are created as described in Section 7.1.

在augment语句中,按照第7.1节的描述创建了YANG-leaf语句。

7.8. Example: ifXTable of the IF-MIB
7.8. 示例:IF-MIB的ifXTable

The translation of the definition of the ifXTable of the IF-MIB [RFC2863] is shown below.

IF-MIB[RFC2863]的ifXTable定义的翻译如下所示。

     smiv2:alias "ifXTable" {
       description
        "A list of interface entries.  The number of entries is
         given by the value of ifNumber.  This table contains
         additional objects for the interface table.";
       smiv2:oid "1.3.6.1.2.1.31.1.1";
     }
        
     smiv2:alias "ifXTable" {
       description
        "A list of interface entries.  The number of entries is
         given by the value of ifNumber.  This table contains
         additional objects for the interface table.";
       smiv2:oid "1.3.6.1.2.1.31.1.1";
     }
        
     smiv2:alias "ifXEntry" {
       description
        "An entry containing additional management information
         applicable to a particular interface.";
       smiv2:oid "1.3.6.1.2.1.31.1.1.1";
     }
        
     smiv2:alias "ifXEntry" {
       description
        "An entry containing additional management information
         applicable to a particular interface.";
       smiv2:oid "1.3.6.1.2.1.31.1.1.1";
     }
        
     augment "/if-mib:IF-MIB/if-mib:ifTable/if-mib:ifEntry" {
       description
        "An entry containing additional management information
         applicable to a particular interface.";
       smiv2:oid "1.3.6.1.2.1.31.1.1.1";
        
     augment "/if-mib:IF-MIB/if-mib:ifTable/if-mib:ifEntry" {
       description
        "An entry containing additional management information
         applicable to a particular interface.";
       smiv2:oid "1.3.6.1.2.1.31.1.1.1";
        
       leaf ifName {
         type snmpv2-tc:DisplayString;
         description
          "The textual name of the interface.  The value of this
           object should be the name of the interface as assigned by
           the local device and should be suitable for use in commands
           entered at the device's `console'.  This might be a text
           name, such as `le0' or a simple port number, such as `1',
           depending on the interface naming syntax of the device.  If
           several entries in the ifTable together represent a single
           interface as named by the device, then each will have the
           same value of ifName.  Note that for an agent which responds
           to SNMP queries concerning an interface on some other
           (proxied) device, then the value of ifName for such an
           interface is the proxied device's local name for it.
        
       leaf ifName {
         type snmpv2-tc:DisplayString;
         description
          "The textual name of the interface.  The value of this
           object should be the name of the interface as assigned by
           the local device and should be suitable for use in commands
           entered at the device's `console'.  This might be a text
           name, such as `le0' or a simple port number, such as `1',
           depending on the interface naming syntax of the device.  If
           several entries in the ifTable together represent a single
           interface as named by the device, then each will have the
           same value of ifName.  Note that for an agent which responds
           to SNMP queries concerning an interface on some other
           (proxied) device, then the value of ifName for such an
           interface is the proxied device's local name for it.
        
           If there is no local name, or this object is otherwise not
           applicable, then this object contains a zero-length string.";
         smiv2:max-access "read-only";
         smiv2:oid "1.3.6.1.2.1.31.1.1.1.1";
       }
        
           If there is no local name, or this object is otherwise not
           applicable, then this object contains a zero-length string.";
         smiv2:max-access "read-only";
         smiv2:oid "1.3.6.1.2.1.31.1.1.1.1";
       }
        

// ... }

// ... }

8. Translation of the OBJECT-IDENTITY Macro
8. 对象标识宏的翻译

The SMIv2 uses invocations of the OBJECT-IDENTITY macro to define information about an OBJECT IDENTIFIER assignment. Invocations of the OBJECT-IDENTITY macro MUST be translated into YANG identity statements as detailed below.

SMIv2使用调用OBJECT-IDENTITY宏来定义有关对象标识符分配的信息。必须将OBJECT-IDENTITY宏的调用转换为以下详细说明的标识语句。

8.1. OBJECT-IDENTITY Translation Rules
8.1. 对象标识转换规则

The name of the OBJECT-IDENTITY macro invocation is used as the name of the generated identity statement. The generated identity statement uses the smiv2:object-identity defined in Section 10 as its base. The clauses of the SMIv2 OBJECT-IDENTITY macro are mapped to YANG statements as follows:

对象标识宏调用的名称用作生成的标识语句的名称。生成的标识语句使用第10节中定义的smiv2:object标识作为其基础。SMIv2 OBJECT-IDENTITY宏的子句映射到以下语句:

o The SMIv2 STATUS clause is mapped to the YANG status statement. The generation of the YANG status statement is skipped if the value of the STATUS clause is current.

o SMIv2 STATUS子句映射到YANG STATUS语句。如果status子句的值为current,则跳过状态语句的生成。

o The SMIv2 DESCRIPTION clause is mapped to the YANG description statement.

o SMIv2 DESCRIPTION子句映射到描述语句。

o The SMIv2 REFERENCE clause is mapped to the YANG reference statement.

o SMIv2引用子句映射到YANG引用语句。

o The value of the SMIv2 OBJECT-IDENTITY macro invocation is translated into an smiv2:oid statement. Refer to the YANG extension defined in Section 10.

o SMIv2对象标识宏调用的值被转换为SMIv2:oid语句。参考第10节中定义的阳延伸。

8.2. Example: diffServTBParamSimpleTokenBucket of the DIFFSERV-MIB
8.2. 示例:DIFFSERV-MIB的diffServTBParamSimpleTokenBucket

The translation of the diffServTBParamSimpleTokenBucket of the DIFFSERV-MIB [RFC3289] is shown below. (Please note that the description should refer to RFC 3290, Section 5.1.3.)

DIFFSERV-MIB[RFC3289]的diffServTBParamSimpleTokenBucket的翻译如下所示。(请注意,说明应参考RFC 3290第5.1.3节。)

     identity diffServTBParamSimpleTokenBucket {
       base "smiv2:object-identity";
       description
        "Two Parameter Token Bucket Meter as described in the Informal
         Differentiated Services Model section 5.2.3.";
       smiv2:oid "1.3.6.1.2.1.97.3.1.1";
     }
        
     identity diffServTBParamSimpleTokenBucket {
       base "smiv2:object-identity";
       description
        "Two Parameter Token Bucket Meter as described in the Informal
         Differentiated Services Model section 5.2.3.";
       smiv2:oid "1.3.6.1.2.1.97.3.1.1";
     }
        
9. Translation of the NOTIFICATION-TYPE Macro
9. 通知类型宏的转换

SMIv2 provides the NOTIFICATION-TYPE macro to define event notifications. YANG provides the notification statement for the same purpose. Invocations of the NOTIFICATION-TYPE macro MUST be translated into YANG notification statements as detailed below.

SMIv2提供通知类型宏来定义事件通知。YANG提供的通知声明也是出于同样的目的。NOTIFICATION-TYPE宏的调用必须转换为以下详细说明的通知语句。

9.1. NOTIFICATION-TYPE Translation Rules
9.1. 通知类型转换规则

The name of the NOTIFICATION-TYPE macro invocation is used as the name of the generated notification statement. The clauses of the NOTIFICATION-TYPE macro are mapped to YANG statements embedded in the notification statement as follows.

通知类型宏调用的名称用作生成的通知语句的名称。NOTIFICATION-TYPE宏的子句映射到嵌入在NOTIFICATION语句中的语句,如下所示。

o The SMIv2 OBJECTS clause is mapped to a sequence of YANG containers. For each object listed in the OBJECTS clause value, a YANG container statement is generated. The name of this container is the string "object-<n>", where <n> is the position of the object in the value of the OBJECTS clause (first element has position 1). If the current object belongs to a conceptual table, then a sequence of leaf statements is generated for each INDEX object of the conceptual table. These leafs are named after the INDEX objects and of type leafref. Finally, a leaf statement is generated named after the current object. If the current object has a MAX-ACCESS of "read-only", "read-write", or "read-create", then the generated leaf is of type leafref. Otherwise, if the current object has a MAX-ACCESS of "accessible-for-notify", then a leaf is generated, following the steps in Section 7.1.

o SMIv2 OBJECTS子句映射到一系列容器。对于OBJECTS子句值中列出的每个对象,将生成一个YANG容器语句。此容器的名称是字符串“object-<n>”,其中<n>是对象在OBJECTS子句的值中的位置(第一个元素的位置为1)。如果当前对象属于概念表,则会为概念表的每个索引对象生成一系列叶语句。这些叶以索引对象命名,类型为leafref。最后,将生成一个以当前对象命名的leaf语句。如果当前对象的MAX-ACCESS为“只读”、“读写”或“读创建”,则生成的叶类型为leafref。否则,如果当前对象的MAX-ACCESS为“accessible for notify”,则按照第7.1节中的步骤生成一个叶。

o The SMIv2 STATUS clause is mapped to the YANG status statement. The generation of the YANG status statement is skipped if the value of the STATUS clause is current.

o SMIv2 STATUS子句映射到YANG STATUS语句。如果status子句的值为current,则跳过状态语句的生成。

o The SMIv2 DESCRIPTION clause is mapped to the YANG description statement.

o SMIv2 DESCRIPTION子句映射到描述语句。

o The SMIv2 REFERENCE clause is mapped to the YANG reference statement.

o SMIv2引用子句映射到YANG引用语句。

o The value of the SMIv2 NOTIFICATION-TYPE macro invocation is translated into an smiv2:oid statement. Refer to the YANG extension defined in Section 10.

o SMIv2通知类型宏调用的值被转换为SMIv2:oid语句。参考第10节中定义的阳延伸。

9.2. Example: linkDown NOTIFICATION-TYPE of IF-MIB
9.2. 示例:IF-MIB的linkDown NOTIFICATION-TYPE

The translation of the linkDown notification of the IF-MIB [RFC2863] is shown below.

IF-MIB[RFC2863]的链接关闭通知的翻译如下所示。

     notification linkDown {
       description
        "A linkDown trap signifies that the SNMP entity, acting in
         an agent role, has detected that the ifOperStatus object for
         one of its communication links is about to enter the down
         state from some other state (but not from the notPresent
         state).  This other state is indicated by the included value
         of ifOperStatus.";
       smiv2:oid "1.3.6.1.6.3.1.1.5.3";
        
     notification linkDown {
       description
        "A linkDown trap signifies that the SNMP entity, acting in
         an agent role, has detected that the ifOperStatus object for
         one of its communication links is about to enter the down
         state from some other state (but not from the notPresent
         state).  This other state is indicated by the included value
         of ifOperStatus.";
       smiv2:oid "1.3.6.1.6.3.1.1.5.3";
        
       container object-1 {
         leaf ifIndex {
           type leafref {
             path "/if-mib:IF-MIB/if-mib:ifTable" +
                  "/if-mib:ifEntry/if-mib:ifIndex";
           }
         }
       }
        
       container object-1 {
         leaf ifIndex {
           type leafref {
             path "/if-mib:IF-MIB/if-mib:ifTable" +
                  "/if-mib:ifEntry/if-mib:ifIndex";
           }
         }
       }
        
       container object-2 {
         leaf ifIndex {
           type leafref {
             path "/if-mib:IF-MIB/if-mib:ifTable" +
                  "/if-mib:ifEntry/if-mib:ifIndex";
           }
         }
         leaf ifAdminStatus {
           type leafref {
             path "/if-mib:IF-MIB/if-mib:ifTable" +
                  "/if-mib:ifEntry/if-mib:ifAdminStatus";
           }
         }
       }
        
       container object-2 {
         leaf ifIndex {
           type leafref {
             path "/if-mib:IF-MIB/if-mib:ifTable" +
                  "/if-mib:ifEntry/if-mib:ifIndex";
           }
         }
         leaf ifAdminStatus {
           type leafref {
             path "/if-mib:IF-MIB/if-mib:ifTable" +
                  "/if-mib:ifEntry/if-mib:ifAdminStatus";
           }
         }
       }
        
       container object-3 {
         leaf ifIndex {
           type leafref {
             path "/if-mib:IF-MIB/if-mib:ifTable" +
                  "/if-mib:ifEntry/if-mib:ifIndex";
           }
         }
         leaf ifOperStatus {
           type leafref {
        
       container object-3 {
         leaf ifIndex {
           type leafref {
             path "/if-mib:IF-MIB/if-mib:ifTable" +
                  "/if-mib:ifEntry/if-mib:ifIndex";
           }
         }
         leaf ifOperStatus {
           type leafref {
        
             path "/if-mib:IF-MIB/if-mib:ifTable" +
                  "/if-mib:ifEntry/if-mib:ifOperStatus";
           }
         }
       }
     }
        
             path "/if-mib:IF-MIB/if-mib:ifTable" +
                  "/if-mib:ifEntry/if-mib:ifOperStatus";
           }
         }
       }
     }
        
10. YANG Language Extension Definition
10. 杨语言扩展定义

This section defines some YANG extension statements that can be used to capture some information present in SMIv2 modules that is not translated into core YANG statements. The YANG module references [RFC2578] and [RFC2579].

本节定义了一些YANG扩展语句,可用于捕获SMIv2模块中未转换为核心YANG语句的某些信息。模块参考[RFC2578]和[RFC2579]。

   <CODE BEGINS> file "ietf-yang-smiv2@2012-06-22.yang"
        
   <CODE BEGINS> file "ietf-yang-smiv2@2012-06-22.yang"
        

module ietf-yang-smiv2 {

模块ietf-yang-smiv2{

   namespace "urn:ietf:params:xml:ns:yang:ietf-yang-smiv2";
   prefix "smiv2";
        
   namespace "urn:ietf:params:xml:ns:yang:ietf-yang-smiv2";
   prefix "smiv2";
        

organization "IETF NETMOD (NETCONF Data Modeling Language) Working Group";

组织“IETF NETMOD(NETCONF数据建模语言)工作组”;

   contact
    "WG Web:   <http://tools.ietf.org/wg/netmod/>
     WG List:  <mailto:netmod@ietf.org>
        
   contact
    "WG Web:   <http://tools.ietf.org/wg/netmod/>
     WG List:  <mailto:netmod@ietf.org>
        
     WG Chair: David Kessens
               <mailto:david.kessens@nsn.com>
        
     WG Chair: David Kessens
               <mailto:david.kessens@nsn.com>
        
     WG Chair: Juergen Schoenwaelder
               <mailto:j.schoenwaelder@jacobs-university.de>
        
     WG Chair: Juergen Schoenwaelder
               <mailto:j.schoenwaelder@jacobs-university.de>
        
     Editor:   Juergen Schoenwaelder
               <mailto:j.schoenwaelder@jacobs-university.de>";
        
     Editor:   Juergen Schoenwaelder
               <mailto:j.schoenwaelder@jacobs-university.de>";
        

description "This module defines YANG extensions that are used to translate SMIv2 concepts into YANG.

description“此模块定义用于将SMIv2概念转换为YANG的YANG扩展。

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

版权所有(c)2012 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

根据IETF信托法律条款第4.c节规定的简化BSD许可证中包含的许可条款,允许以源代码和二进制格式重新分发和使用,无论是否修改

Relating to IETF Documents (http://trustee.ietf.org/license-info).

与IETF文件相关(http://trustee.ietf.org/license-info).

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

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

   revision 2012-06-22 {
     description
      "Initial revision.";
     reference
      "RFC 6643: Translation of Structure of Management Information
       Version 2 (SMIv2) MIB Modules to YANG Modules";
   }
        
   revision 2012-06-22 {
     description
      "Initial revision.";
     reference
      "RFC 6643: Translation of Structure of Management Information
       Version 2 (SMIv2) MIB Modules to YANG Modules";
   }
        
   identity object-identity {
     description
      "Base identity for all SMIv2 OBJECT-IDENTITYs.";
   }
        
   identity object-identity {
     description
      "Base identity for all SMIv2 OBJECT-IDENTITYs.";
   }
        
   typedef opaque {
     type binary;
     description
      "The Opaque type supports the capability to pass arbitrary ASN.1
       syntax.  A value is encoded using the ASN.1 Basic Encoding Rules
       into a string of octets.  This, in turn, is encoded as an OCTET
       STRING, in effect 'double-wrapping' the original ASN.1 value.
        
   typedef opaque {
     type binary;
     description
      "The Opaque type supports the capability to pass arbitrary ASN.1
       syntax.  A value is encoded using the ASN.1 Basic Encoding Rules
       into a string of octets.  This, in turn, is encoded as an OCTET
       STRING, in effect 'double-wrapping' the original ASN.1 value.
        
       In the value set and its semantics, this type is equivalent to
       the Opaque type of the SMIv2.  This type exists in the SMIv2
       solely for backward-compatibility reasons and this is also
       true for this YANG data type.";
     reference
      "RFC 2578: Structure of Management Information Version 2 (SMIv2)";
   }
        
       In the value set and its semantics, this type is equivalent to
       the Opaque type of the SMIv2.  This type exists in the SMIv2
       solely for backward-compatibility reasons and this is also
       true for this YANG data type.";
     reference
      "RFC 2578: Structure of Management Information Version 2 (SMIv2)";
   }
        
   extension display-hint {
     argument "format";
     description
      "The display-hint statement takes as an argument the DISPLAY-HINT
       assigned to an SMIv2 textual convention.";
     reference
      "RFC 2579: Textual Conventions for SMIv2";
   }
        
   extension display-hint {
     argument "format";
     description
      "The display-hint statement takes as an argument the DISPLAY-HINT
       assigned to an SMIv2 textual convention.";
     reference
      "RFC 2579: Textual Conventions for SMIv2";
   }
        
   extension max-access {
     argument "access";
     description
      "The max-access statement takes as an argument the MAX-ACCESS
       assigned to an SMIv2 object definition.
        
   extension max-access {
     argument "access";
     description
      "The max-access statement takes as an argument the MAX-ACCESS
       assigned to an SMIv2 object definition.
        
       The MAX-ACCESS value is SMIv2 specific and has no impact on
       the access provided to YANG objects through protocols such
       as NETCONF.";
     reference
      "RFC 2578: Structure of Management Information Version 2 (SMIv2)";
   }
        
       The MAX-ACCESS value is SMIv2 specific and has no impact on
       the access provided to YANG objects through protocols such
       as NETCONF.";
     reference
      "RFC 2578: Structure of Management Information Version 2 (SMIv2)";
   }
        
   extension defval {
     argument "value";
     description
      "The defval statement takes as an argument a default value
       defined by an SMIv2 DEFVAL clause.  Note that the value is in
       the SMIv2 value space defined by the SMIv2 syntax of the
       corresponding object and not in the YANG value space
       defined by the corresponding YANG data type.";
     reference
      "RFC 2578: Structure of Management Information Version 2 (SMIv2)";
   }
        
   extension defval {
     argument "value";
     description
      "The defval statement takes as an argument a default value
       defined by an SMIv2 DEFVAL clause.  Note that the value is in
       the SMIv2 value space defined by the SMIv2 syntax of the
       corresponding object and not in the YANG value space
       defined by the corresponding YANG data type.";
     reference
      "RFC 2578: Structure of Management Information Version 2 (SMIv2)";
   }
        
   extension implied {
     argument "index";
     description
      "If an SMIv2 INDEX object is preceded by the IMPLIED keyword, then
       the implied statement is present in the YANG module and takes as
       an argument the name of the IMPLIED index object.";
     reference
      "RFC 2578: Structure of Management Information Version 2 (SMIv2)";
    }
        
   extension implied {
     argument "index";
     description
      "If an SMIv2 INDEX object is preceded by the IMPLIED keyword, then
       the implied statement is present in the YANG module and takes as
       an argument the name of the IMPLIED index object.";
     reference
      "RFC 2578: Structure of Management Information Version 2 (SMIv2)";
    }
        
   extension alias {
     argument "descriptor";
     description
      "The alias statement introduces an SMIv2 descriptor.  The body of
       the alias statement is expected to contain an oid statement that
       provides the numeric OID associated with the descriptor.";
     reference
      "RFC 2578: Structure of Management Information Version 2 (SMIv2)";
   }
        
   extension alias {
     argument "descriptor";
     description
      "The alias statement introduces an SMIv2 descriptor.  The body of
       the alias statement is expected to contain an oid statement that
       provides the numeric OID associated with the descriptor.";
     reference
      "RFC 2578: Structure of Management Information Version 2 (SMIv2)";
   }
        
   extension oid {
     argument "value";
     description
      "The oid statement takes as an argument the object identifier
       assigned to an SMIv2 definition.  The object identifier value
       is written in decimal dotted notation.";
     reference
      "RFC 2578: Structure of Management Information Version 2 (SMIv2)";
   }
        
   extension oid {
     argument "value";
     description
      "The oid statement takes as an argument the object identifier
       assigned to an SMIv2 definition.  The object identifier value
       is written in decimal dotted notation.";
     reference
      "RFC 2578: Structure of Management Information Version 2 (SMIv2)";
   }
        
   extension subid {
     argument "value";
     description
      "The subid statement takes as an argument the last sub-identifier
       of the object identifier assigned to an SMIv2 definition.  The
       sub-identifier value is a single positive decimal natural number.
       The subid statement may not be used as a substatement to any
       top-level node in a YANG document.  The subid substatement may
       be used only as a substatement to a node having a parent node
       defined with either an smiv2:oid or smiv2:subid substatement.";
     reference
      "RFC 2578: Structure of Management Information Version 2 (SMIv2)";
   }
        
   extension subid {
     argument "value";
     description
      "The subid statement takes as an argument the last sub-identifier
       of the object identifier assigned to an SMIv2 definition.  The
       sub-identifier value is a single positive decimal natural number.
       The subid statement may not be used as a substatement to any
       top-level node in a YANG document.  The subid substatement may
       be used only as a substatement to a node having a parent node
       defined with either an smiv2:oid or smiv2:subid substatement.";
     reference
      "RFC 2578: Structure of Management Information Version 2 (SMIv2)";
   }
        

}

}

<CODE ENDS>

<代码结束>

11. Implementing Configuration Data Nodes
11. 实现配置数据节点

The result of the translation of SMIv2 MIB modules into YANG modules, even if SMIv2 objects are read-write or read-create, consists of read-only (config false) YANG objects. One reason is that the persistency models of the underlying protocols, SNMP and NETCONF, are quite different. With SNMP, the persistency of a writable object depends either on the object definition itself (i.e., the text in the DESCRIPTION clause) or the persistency properties of the conceptual row it is part of, sometimes controlled via a columnar object using the StorageType textual convention. With NETCONF, the persistency of configuration objects is determined by the properties of the underlying datastore. Furthermore, NETCONF as defined in [RFC6241] does not provide a standard operation to modify operational state. The <edit-config> and <copy-config> operations only manipulate configuration data. As a consequence of these considerations, it is not possible to generate YANG configuration data nodes from SMIv2 definitions in an automated way.

将SMIv2 MIB模块转换为YANG模块的结果,即使SMIv2对象是读写或读创建的,也由只读(config false)YANG对象组成。一个原因是底层协议SNMP和NETCONF的持久性模型大不相同。对于SNMP,可写对象的持久性取决于对象定义本身(即描述子句中的文本)或其所属概念行的持久性属性,有时通过使用StorageType文本约定的列对象进行控制。使用NETCONF,配置对象的持久性由底层数据存储的属性决定。此外,[RFC6241]中定义的NETCONF不提供修改操作状态的标准操作。<edit config>和<copy config>操作仅操作配置数据。由于这些考虑,不可能自动从SMIv2定义生成配置数据节点。

However, for selected SMIv2 objects where the SNMP and NETCONF persistency semantics are consistent, implementations may choose to implement some YANG data nodes generated from SMIv2 definitions as configuration data nodes. Such a deviation from the generated read-only YANG module should be formally documented in the form of a separate YANG module that uses YANG deviation statements to change the config property of the data nodes implemented as configuration data nodes from false to true. Deviations that change the config false property to true without any other changes to the semantics of the data node do not affect the compliance with the YANG module generated from an SMIv2 module.

但是,对于SNMP和NETCONF持久性语义一致的选定SMIv2对象,实现可能会选择将从SMIv2定义生成的某些数据节点实现为配置数据节点。这种与生成的只读YANG模块的偏差应以单独YANG模块的形式正式记录,该模块使用YANG偏差语句将作为配置数据节点实现的数据节点的配置属性从false更改为true。将config false属性更改为true而不对数据节点的语义进行任何其他更改的偏差不会影响对SMIv2模块生成的模块的遵从性。

11.1. Example: addressMapControlTable of RMON2-MIB
11.1. 示例:RMON2-MIB的addressMapControlTable

The following example demonstrates how certain columnar objects of the addressMapControlTable of the RMON2-MIB [RFC4502] can be turned into YANG configuration data nodes. Note that YANG deviations affect the property of the target node only and are not inherited downwards.

以下示例演示如何将RMON2-MIB[RFC4502]的addressMapControlTable的某些列对象转换为配置数据节点。请注意,偏差仅影响目标节点的属性,不会向下继承。

module acme-RMON2-MIB-deviations {

模块acme-RMON2-MIB-2{

       namespace "http://acme.example.com/RMON2-MIB-deviations";
       prefix "acme-rmon2-devs";
        
       namespace "http://acme.example.com/RMON2-MIB-deviations";
       prefix "acme-rmon2-devs";
        
       import RMON2-MIB {
         prefix "rmon2-mib";
         revision-date 2006-05-02;
       }
        
       import RMON2-MIB {
         prefix "rmon2-mib";
         revision-date 2006-05-02;
       }
        
       revision 2012-01-11 {
         description
           "First version.";
       }
        
       revision 2012-01-11 {
         description
           "First version.";
       }
        
       deviation "/rmon2-mib:RMON2-MIB" {
         deviate replace {
           config true;
         }
       }
        
       deviation "/rmon2-mib:RMON2-MIB" {
         deviate replace {
           config true;
         }
       }
        
       deviation "/rmon2-mib:RMON2-MIB/"
               + "rmon2-mib:addressMapControlTable" {
         deviate replace {
           config true;
         }
       }
        
       deviation "/rmon2-mib:RMON2-MIB/"
               + "rmon2-mib:addressMapControlTable" {
         deviate replace {
           config true;
         }
       }
        
       deviation "/rmon2-mib:RMON2-MIB/"
               + "rmon2-mib:addressMapControlTable/"
               + "rmon2-mib:addressMapControlEntry" {
         deviate replace {
           config true;
         }
       }
        
       deviation "/rmon2-mib:RMON2-MIB/"
               + "rmon2-mib:addressMapControlTable/"
               + "rmon2-mib:addressMapControlEntry" {
         deviate replace {
           config true;
         }
       }
        
       deviation "/rmon2-mib:RMON2-MIB/"
               + "rmon2-mib:addressMapControlTable/"
               + "rmon2-mib:addressMapControlEntry/"
               + "rmon2-mib:addressMapControlIndex" {
         deviate replace {
           config true;
         }
       }
        
       deviation "/rmon2-mib:RMON2-MIB/"
               + "rmon2-mib:addressMapControlTable/"
               + "rmon2-mib:addressMapControlEntry/"
               + "rmon2-mib:addressMapControlIndex" {
         deviate replace {
           config true;
         }
       }
        
       deviation "/rmon2-mib:RMON2-MIB/"
               + "rmon2-mib:addressMapControlTable/"
               + "rmon2-mib:addressMapControlEntry/"
               + "rmon2-mib:addressMapControlDataSource" {
         deviate replace {
           config true;
         }
       }
        
       deviation "/rmon2-mib:RMON2-MIB/"
               + "rmon2-mib:addressMapControlTable/"
               + "rmon2-mib:addressMapControlEntry/"
               + "rmon2-mib:addressMapControlDataSource" {
         deviate replace {
           config true;
         }
       }
        
       deviation "/rmon2-mib:RMON2-MIB/"
               + "rmon2-mib:addressMapControlTable/"
               + "rmon2-mib:addressMapControlEntry/"
               + "rmon2-mib:addressMapControlOwner" {
         deviate replace {
           config true;
         }
       }
     }
        
       deviation "/rmon2-mib:RMON2-MIB/"
               + "rmon2-mib:addressMapControlTable/"
               + "rmon2-mib:addressMapControlEntry/"
               + "rmon2-mib:addressMapControlOwner" {
         deviate replace {
           config true;
         }
       }
     }
        

A NETCONF server that implements the RMON2-MIB module with these deviations would advertise the following capabilities in its <hello> message (where whitespace has been added for readability):

实现带有这些偏差的RMON2-MIB模块的NETCONF服务器将在其<hello>消息中公布以下功能(其中添加了空格以提高可读性):

     <capability>
       urn:ietf:params:xml:ns:yang:smiv2:RMON2-MIB?
         module=RMON2-MIB&amp;
         revision=2006-05-02&amp;
         deviations=acme-RMON2-MIB-deviations
     </capability>
     <capability>
       http://acme.example.com/RMON2-MIB-deviations?
         module=acme-RMON2-MIB-deviations&amp;
         revision=2012-01-11
     </capability>
        
     <capability>
       urn:ietf:params:xml:ns:yang:smiv2:RMON2-MIB?
         module=RMON2-MIB&amp;
         revision=2006-05-02&amp;
         deviations=acme-RMON2-MIB-deviations
     </capability>
     <capability>
       http://acme.example.com/RMON2-MIB-deviations?
         module=acme-RMON2-MIB-deviations&amp;
         revision=2012-01-11
     </capability>
        
12. IANA Considerations
12. IANA考虑

This document registers two URIs in the IETF XML registry [RFC3688]. Following the format in RFC 3688, the following registrations have been made.

本文档在IETF XML注册表[RFC3688]中注册了两个URI。按照RFC 3688中的格式,进行了以下注册。

     URI: urn:ietf:params:xml:ns:yang:ietf-yang-smiv2
        
     URI: urn:ietf:params:xml:ns:yang:ietf-yang-smiv2
        

Registrant Contact: The NETMOD WG of the IETF.

注册人联系人:IETF的NETMOD工作组。

XML: N/A, the requested URI is an XML namespace.

XML:N/A,请求的URI是一个XML名称空间。

     URI: urn:ietf:params:xml:ns:yang:smiv2
        
     URI: urn:ietf:params:xml:ns:yang:smiv2
        

Registrant Contact: The NETMOD WG of the IETF.

注册人联系人:IETF的NETMOD工作组。

XML: N/A, the requested URI is an XML namespace.

XML:N/A,请求的URI是一个XML名称空间。

This document registers a YANG module in the YANG Module Names registry [RFC6020].

本文档在YANG模块名称注册表[RFC6020]中注册YANG模块。

     Name:         ietf-yang-smiv2
     Namespace:    urn:ietf:params:xml:ns:yang:ietf-yang-smiv2
     Prefix:       smiv2
     Reference:    RFC 6643
        
     Name:         ietf-yang-smiv2
     Namespace:    urn:ietf:params:xml:ns:yang:ietf-yang-smiv2
     Prefix:       smiv2
     Reference:    RFC 6643
        
13. Security Considerations
13. 安全考虑

This document defines a translation of SMIv2 MIB modules into YANG modules, enabling read-only (config false) access to data objects defined in SMIv2 MIB modules via NETCONF. The translation itself has no security impact on the Internet.

本文档定义了SMIv2 MIB模块到YANG模块的转换,允许通过NETCONF对SMIv2 MIB模块中定义的数据对象进行只读(config false)访问。翻译本身对互联网没有安全影响。

Users of YANG data models generated from SMIv2 data models that have been published in the RFC series are advised to consult the security considerations of the respective RFCs. The security considerations of RFCs containing SMIv2 data models explain which objects are sensitive and important to protect. NETCONF users are encouraged to make use of the NETCONF access control model [RFC6536], which allows the specification of access control rules to protect potentially sensitive information.

建议从RFC系列中发布的SMIv2数据模型生成的数据模型的用户参考相应RFC的安全注意事项。包含SMIv2数据模型的RFC的安全注意事项解释了哪些对象是敏感的,需要保护。鼓励NETCONF用户使用NETCONF访问控制模型[RFC6536],该模型允许指定访问控制规则来保护潜在的敏感信息。

14. Acknowledgements
14. 致谢

The author wishes to thank the following individuals for providing helpful comments on various draft versions of this document: Andy Bierman, Benoit Claise, Martin Bjorklund, Leif Johansson, David Reid, Dan Romascanu, and David Spakes.

作者希望感谢以下个人对本文件的各种草案版本提供了有益的意见:安迪·比尔曼、贝诺特·克莱斯、马丁·比约克隆德、莱夫·约翰逊、大卫·里德、丹·罗马斯坎努和大卫·斯帕克斯。

15. References
15. 工具书类
15.1. Normative References
15.1. 规范性引用文件

[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.

[RFC2119]Bradner,S.,“RFC中用于表示需求水平的关键词”,BCP 14,RFC 2119,1997年3月。

[RFC2578] McCloghrie, K., Ed., Perkins, D., Ed., and J. Schoenwaelder, Ed., "Structure of Management Information Version 2 (SMIv2)", STD 58, RFC 2578, April 1999.

[RFC2578]McCloghrie,K.,Ed.,Perkins,D.,Ed.,和J.Schoenwaeld,Ed.“管理信息的结构版本2(SMIv2)”,STD 58,RFC 2578,1999年4月。

[RFC2579] McCloghrie, K., Ed., Perkins, D., Ed., and J. Schoenwaelder, Ed., "Textual Conventions for SMIv2", STD 58, RFC 2579, April 1999.

[RFC2579]McCloghrie,K.,Ed.,Perkins,D.,Ed.,和J.Schoenwaeld,Ed.“SMIv2的文本约定”,STD 58,RFC 2579,1999年4月。

[RFC2580] McCloghrie, K., Perkins, D., and J. Schoenwaelder, "Conformance Statements for SMIv2", STD 58, RFC 2580, April 1999.

[RFC2580]McCloghrie,K.,Perkins,D.,和J.Schoenwaeld,“SMIv2的一致性声明”,STD 58,RFC 25801999年4月。

[RFC6020] Bjorklund, M., Ed., "YANG - A Data Modeling Language for the Network Configuration Protocol (NETCONF)", RFC 6020, October 2010.

[RFC6020]Bjorklund,M.,Ed.“YANG-网络配置协议(NETCONF)的数据建模语言”,RFC6020,2010年10月。

[RFC6021] Schoenwaelder, J., "Common YANG Data Types", RFC 6021, October 2010.

[RFC6021]Schoenwaeld,J.,“常见的杨氏数据类型”,RFC 602112010年10月。

15.2. Informative References
15.2. 资料性引用

[RFC2863] McCloghrie, K. and F. Kastenholz, "The Interfaces Group MIB", RFC 2863, June 2000.

[RFC2863]McCloghrie,K.和F.Kastenholz,“接口组MIB”,RFC 28632000年6月。

[RFC3289] Baker, F., Chan, K., and A. Smith, "Management Information Base for the Differentiated Services Architecture", RFC 3289, May 2002.

[RFC3289]Baker,F.,Chan,K.和A.Smith,“差异化服务体系结构的管理信息库”,RFC 3289,2002年5月。

[RFC3584] Frye, R., Levi, D., Routhier, S., and B. Wijnen, "Coexistence between Version 1, Version 2, and Version 3 of the Internet-standard Network Management Framework", RFC 3584, August 2003.

[RFC3584]Frye,R.,Levi,D.,Routhier,S.,和B.Wijnen,“互联网标准网络管理框架版本1,版本2和版本3之间的共存”,RFC 3584,2003年8月。

[RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, January 2004.

[RFC3688]Mealling,M.“IETF XML注册表”,BCP 81,RFC 3688,2004年1月。

[RFC4181] Heard, C., "Guidelines for Authors and Reviewers of MIB Documents", BCP 111, RFC 4181, September 2005.

[RFC4181]Heard,C.,“MIB文件的作者和评审者指南”,BCP 111,RFC 41812005年9月。

[RFC4502] Waldbusser, S., "Remote Network Monitoring Management Information Base Version 2", RFC 4502, May 2006.

[RFC4502]Waldbusser,S.,“远程网络监控管理信息库版本2”,RFC4502,2006年5月。

[RFC6241] Enns, R., Ed., Bjorklund, M., Ed., Schoenwaelder, J., Ed., and A. Bierman, Ed., "Network Configuration Protocol (NETCONF)", RFC 6241, June 2011.

[RFC6241]Enns,R.,Ed.,Bjorklund,M.,Ed.,Schoenwaeld,J.,Ed.,和A.Bierman,Ed.“网络配置协议(NETCONF)”,RFC 62412011年6月。

[RFC6536] Bierman, A., Ed. and M. Bjorklund, Ed., "Network Configuration Protocol (NETCONF) Access Control Model", RFC 6536, March 2012.

[RFC6536]Bierman,A.,Ed.和M.Bjorklund,Ed.,“网络配置协议(NETCONF)访问控制模型”,RFC 65362012年3月。

Appendix A. Mapping of Well-Known Types (Normative)

附录A.已知类型的映射(规范性)

This normative appendix describes the mapping of SMIv2 types to YANG types. The mapping is fully consistent with Tables 1 and 2 of [RFC6021].

本规范性附录描述了SMIv2类型到YANG类型的映射。映射与[RFC6021]的表1和表2完全一致。

SMIv2 Module: SNMPv2-SMI SMIv2 Type: INTEGER (used as an enumeration) YANG Type: enumeration

SMIv2模块:SNMPv2 SMI SMIv2类型:整数(用作枚举)YANG类型:枚举

SMIv2 Module: SNMPv2-SMI SMIv2 Type: INTEGER (used as a numeric type) YANG Type: int32

SMIv2模块:SNMPv2 SMI SMIv2类型:整数(用作数字类型)YANG类型:int32

SMIv2 Module: SNMPv2-SMI SMIv2 Type: Integer32 YANG Type: int32

SMIv2模块:SNMPv2 SMI SMIv2类型:整数32阳类型:int32

SMIv2 Module: SNMPv2-SMI SMIv2 Type: OCTET STRING (used as a binary string) YANG Type: binary

SMIv2模块:SNMPv2 SMI SMIv2类型:八位字节字符串(用作二进制字符串)YANG类型:二进制

SMIv2 Module: SNMPv2-SMI SMIv2 Type: OCTET STRING (used to hold UTF-8 or ASCII characters) YANG Type: string

SMIv2模块:SNMPv2 SMI SMIv2类型:八位字节字符串(用于保存UTF-8或ASCII字符)类型:字符串

SMIv2 Module: SNMPv2-SMI SMIv2 Type: OBJECT IDENTIFIER YANG Module: ietf-yang-types YANG Type: object-identifier-128

SMIv2模块:SNMPv2 SMI SMIv2类型:对象标识符YANG模块:ietf YANG类型YANG类型:对象标识符-128

SMIv2 Module: SNMPv2-SMI SMIv2 Type: BITS YANG Type: bits

SMIv2模块:SNMPv2 SMI SMIv2类型:位类型:位

SMIv2 Module: SNMPv2-SMI SMIv2 Type: IpAddress YANG Module: ietf-inet-types YANG Type: ipv4-address

SMIv2模块:SNMPv2 SMI SMIv2类型:IpAddress YANG模块:ietf inet类型YANG类型:ipv4地址

SMIv2 Module: SNMPv2-SMI SMIv2 Type: Counter32 YANG Module: ietf-yang-types YANG Type: counter32

SMIv2模块:SNMPv2 SMI SMIv2类型:计数器32阳模块:ietf阳类型阳类型:计数器32

SMIv2 Module: SNMPv2-SMI SMIv2 Type: Gauge32 YANG Module: ietf-yang-types YANG Type: gauge32

SMIv2模块:SNMPv2 SMI SMIv2类型:量规32阳模块:ietf阳类型阳类型:量规32

SMIv2 Module: SNMPv2-SMI SMIv2 Type: TimeTicks YANG Module: ietf-yang-types YANG Type: timeticks

SMIv2模块:SNMPv2 SMI SMIv2类型:TimeTicks阳模块:ietf阳类型阳类型:TimeTicks

SMIv2 Module: SNMPv2-SMI SMIv2 Type: Counter64 YANG Module: ietf-yang-types YANG Type: counter64

SMIv2模块:SNMPv2 SMI SMIv2类型:计数器64阳模块:ietf阳类型阳类型:计数器64

SMIv2 Module: SNMPv2-SMI SMIv2 Type: Unsigned32 YANG Type: uint32

SMIv2模块:SNMPv2 SMI SMIv2类型:未签名32阳类型:uint32

SMIv2 Module: SNMPv2-SMI SMIv2 Type: Opaque YANG Module: ietf-yang-smiv2 YANG Type: opaque

SMIv2模块:SNMPv2 SMI SMIv2类型:不透明阳模块:ietf-YANG-SMIv2阳类型:不透明

SMIv2 Module: SNMPv2-TC SMIv2 Type: PhysAddress YANG Module: ietf-yang-types YANG Type: phys-address

SMIv2模块:SNMPv2 TC SMIv2类型:物理地址YANG模块:ietf YANG类型YANG类型:物理地址

SMIv2 Module: SNMPv2-TC SMIv2 Type: MacAddress YANG Module: ietf-yang-types YANG Type: mac-address

SMIv2模块:SNMPv2 TC SMIv2类型:MacAddress YANG模块:ietf YANG类型YANG类型:mac地址

SMIv2 Module: SNMPv2-TC SMIv2 Type: TruthValue YANG Type: boolean

SMIv2模块:SNMPv2 TC SMIv2类型:TruthValue类型:布尔型

SMIv2 Module: SNMPv2-TC SMIv2 Type: TimeStamp YANG Module: ietf-yang-types YANG Type: timestamp

SMIv2模块:SNMPv2 TC SMIv2类型:时间戳YANG模块:ietf YANG类型YANG类型:时间戳

SMIv2 Module: RMON2-MIB SMIv2 Type: ZeroBasedCounter32 YANG Module: ietf-yang-types YANG Type: zero-based-counter32

SMIv2模块:RMON2-MIB SMIv2类型:零基计数器32阳模块:ietf阳类型阳类型:零基计数器32

SMIv2 Module: HCNUM-TC SMIv2 Type: ZeroBasedCounter64 YANG Module: ietf-yang-types YANG Type: zero-based-counter64

SMIv2模块:HCNUM-TC SMIv2类型:零基计数器64阳模块:ietf阳类型阳类型:零基计数器64

SMIv2 Module: HCNUM-TC SMIv2 Type: CounterBasedGauge64 YANG Module: ietf-yang-types YANG Type: gauge64

SMIv2模块:HCNUM-TC SMIv2类型:基于计数器的gauge64阳模块:ietf阳类型阳类型:量规64

SMIv2 Module: INET-ADDRESS-MIB SMIv2 Type: InetAutonomousSystemNumber YANG Module: ietf-inet-types YANG Type: as-number

SMIv2模块:INET-ADDRESS-MIB SMIv2类型:InetAutonomousSystemNumber YANG模块:ietf INET类型YANG类型:as编号

SMIv2 Module: INET-ADDRESS-MIB SMIv2 Type: InetVersion YANG Module: ietf-inet-types YANG Type: ip-version

SMIv2模块:INET-ADDRESS-MIB SMIv2类型:InetVersion YANG模块:ietf INET类型YANG类型:ip版本

SMIv2 Module: INET-ADDRESS-MIB SMIv2 Type: InetPortNumber YANG Module: ietf-inet-types YANG Type: port-number

SMIv2模块:INET-ADDRESS-MIB SMIv2类型:InetPortNumber YANG模块:ietf INET类型YANG类型:端口号

SMIv2 Module: DIFFSERV-DSCP-TC SMIv2 Type: Dscp YANG Module: ietf-inet-types YANG Type: dscp

SMIv2模块:DIFFSERV-DSCP-TC SMIv2类型:DSCP YANG模块:ietf inet类型YANG类型:DSCP

SMIv2 Module: IPV6-FLOW-LABEL-MIB SMIv2 Type: IPv6FlowLabel YANG Module: ietf-inet-types YANG Type: ipv6-flow-label

SMIv2模块:IPV6-FLOW-LABEL-MIB SMIv2类型:IPv6FlowLabel YANG模块:ietf inet类型YANG类型:IPV6流标签

SMIv2 Module: URI-TC-MIB SMIv2 Type: Uri YANG Module: ietf-inet-types YANG Type: uri

SMIv2模块:URI-TC-MIB SMIv2类型:URI YANG模块:ietf inet类型YANG类型:URI

Appendix B. Module Prefix Generation (Informative)

附录B.模块前缀生成(资料性)

This section describes an algorithm to generate module prefixes to be used in the import statements. The input of the prefix generation algorithm is a set of prefixes (usually derived from imported module names) and a specific module name to be converted into a prefix. The algorithm described below produces a prefix for the given module name that is unique within the set of prefixes.

本节介绍生成要在导入语句中使用的模块前缀的算法。前缀生成算法的输入是一组前缀(通常来自导入的模块名称)和要转换为前缀的特定模块名称。下面描述的算法为给定模块名生成前缀,该前缀在前缀集中是唯一的。

                       +-----------------+--------+
                       | YANG Module     | Prefix |
                       +-----------------+--------+
                       | ietf-yang-types | yang   |
                       | ietf-inet-types | inet   |
                       | ietf-yang-smiv2 | smiv2  |
                       +-----------------+--------+
        
                       +-----------------+--------+
                       | YANG Module     | Prefix |
                       +-----------------+--------+
                       | ietf-yang-types | yang   |
                       | ietf-inet-types | inet   |
                       | ietf-yang-smiv2 | smiv2  |
                       +-----------------+--------+
        

Table 1: Special Prefixes For Well-Known YANG Modules

表1:知名YANG模块的特殊前缀

o First, some predefined translations mapping well-known YANG modules to short prefixes are tried (see Table 1). If a fixed translation rule exists and leads to a conflict-free prefix, then the fixed translation is used.

o 首先,尝试一些预定义的翻译,将著名的YANG模块映射到短前缀(见表1)。如果存在固定翻译规则并导致无冲突前缀,则使用固定翻译。

o Otherwise, prefixes are generated by tokenizing a YANG module name, using hyphens as token separators. The tokens derived from the module name are converted to lowercase characters. The prefix then becomes the shortest sequence of tokens concatenated using hyphens as separators, which includes at least two tokens and which is unique among all prefixes used in the YANG module.

o 否则,前缀将通过使用连字符作为标记分隔符对模块名称进行标记来生成。从模块名称派生的标记将转换为小写字符。前缀随后成为使用连字符作为分隔符连接的最短令牌序列,该序列至少包括两个令牌,并且在模块中使用的所有前缀中是唯一的。

In the worst case, the prefix derived from an SMIv2 module name becomes the SMIv2 module name translated to lowercase. But on average, much shorter prefixes are generated.

在最坏的情况下,从SMIv2模块名派生的前缀将成为转换为小写的SMIv2模块名。但平均而言,生成的前缀要短得多。

Author's Address

作者地址

Juergen Schoenwaelder Jacobs University

尤尔根·舍恩瓦埃尔德·雅各布斯大学

   EMail: j.schoenwaelder@jacobs-university.de
        
   EMail: j.schoenwaelder@jacobs-university.de