No relevant resource is found in the selected language.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Read our privacy policy>Search


To have a better experience, please upgrade your IE browser.


Configuration Guide - Network Management and Monitoring

CloudEngine 8800, 7800, 6800, and 5800 V200R005C10

This document describes the configurations of Network Management and Monitoring, including SNMP, RMON, NETCONF, OpenFlow, LLDP, NQA, Mirroring, Packet Capture, Packet Trace, Path and Connectivity Detection Configuration, NetStream, sFlow, and iPCA.
Rate and give feedback:
Huawei uses machine translation combined with human proofreading to translate this document to different languages in order to help you better understand the content of this document. Note: Even the most advanced machine translation cannot match the quality of professional translators. Huawei shall not bear any responsibility for translation accuracy and it is recommended that you refer to the English document (a link for which has been provided).
YANG Data Types

YANG Data Types

Configuration and State Data

YANG can model state data and configuration data based on the "config" statement. If a node is tagged with "config false", its subhierarchy is flagged as state data. If a node is tagged with "config true", its subhierarchy is flagged as configuration data. When state data is queried using NETCONF's <get> operation, parent containers, lists, and key leaf nodes are also reported, providing a specific context for the state data.

In the following example, two leaf nodes are defined for each interface, a configured interface status and an observed speed. The observed speed is not configurable, so it can be returned with NETCONF's <get> operations, but not with <get-config> operations.

container interfaces {

  list interface {
    key "name";
    leaf name {
      type string;

    leaf status {
      type boolean;
      default "true";

    leaf observed-speed  {
      type yang:gauge64;
      units "bits/second";
      config false;

Built-in Types

Like many programming languages, YANG has a set of built-in types, but differs in terms of special requirements from the management domain. Table 3-10 summarizes the built-in types.

Table 3-10 Built-in types
Type Name Description


Any binary data


Set of bits or flags


"true" or "false"


64-bit signed decimal number


Leaf node without a value


Enumerated strings


Reference to an abstract identity


Reference to a data tree node


8-bit signed integer


16-bit signed integer


32-bit signed integer


64-bit signed integer


Reference to a leaf instance


Human-readable string


8-bit unsigned integer


16-bit unsigned integer


32-bit unsigned integer


64-bit unsigned integer


Choice of member types

Derived Types

YANG can define derived types from base types using the "typedef" statement. Base types can be built-in types or derived types.

YANG example:

typedef percent {
 type uint8 {
  range "0 .. 100";
 description "Percentage";
leaf completed {
 type percent;

NETCONF XML example:


Extending Data Models

Extending data models (augment)

YANG allows a module to insert additional nodes into data models. This is useful for helping vendors to add vendor-specific parameters to standard data models in an interoperable way.

The "augment" statement defines the location in the data model hierarchy where new nodes are inserted, and the "when" statement defines the conditions when the new nodes are valid.

YANG example:

augment /system/login/user {
 when "class != 'wheel'";
 leaf uid {
  type uint16 {
   range "1000 .. 30000";

This example defines a "uid" node that is valid only when the user's "class" is not "wheel".

Updated: 2019-04-20

Document ID: EDOC1100075365

Views: 34518

Downloads: 123

Average rating:
This Document Applies to these Products
Related Version
Related Documents
Previous Next