Netconf

YANG is a data modeling language for NETCONF. It allows the description of hierarchies of data nodes ("nodes") and the constraints that exist among them. YANG defines data models and how to manipulate those models via NETCONF protocol operations.

Each YANG module defines a data model, uniquely identified by a namespace URI. These data models are extensible in a manner that allows tight integration of standard data models and proprietary data models. Models are built from organizational containers, lists of data nodes, and data-node-forming leafs of the data tree.

YANG is used to model configuration and state data manipulated by the NETCONF protocol, NETCONF operations, and NETCONF notifications.

YANG uses a compact syntax since human readability is highest priority

YIN is an XML representation of YANG (lossless roundtrip conversion)

YANG can be translated to XML Schema and RELAX NG so that existing XML tools can be utilized

YANG can be translated to Schematron to validate NETCONF content

YANG RFC's

RFC 6020

YANG Version

RFC 6021

Common Data Types

RFC 6087

Guidelines for Authors/Reviewers

RFC 6095

YANG Language Abstractions

RFC 6110

Mapping YANG to DSDL

RFC 6643

Mapping SMIv2 to YANG

RFC 6244

NETCONF / YANG Architecture

Built-in types

YANG has a set of built-in types, similar to those of many programming languages, but with some differences due to special requirements from the management domain.

Name

Description

binary

Any binary data

bits

A set of bits or flags

boolean

"true" or "false"

decimal64

64-bit signed decimal number

empty

A leaf that does not have any value

enumeration

Enumerated strings

identityref

A reference to an abstract identity

instance-identifier

References a data tree node

int8, int16, int32, int64

8-bit, 16-bit, 32-bit, 64-bit signed integer

leafref

A reference to a leaf instance

string

Human-readable string

uint8, uint16, uint32, uint64

8-bit, 16-bit, 32-bit, 64-bit unsigned integer

union

Choice of member types

Derived Types (typedef)

YANG can define derived types from base types using the "typedef" statement. A base type can be either a built-in type or a derived type, allowing a hierarchy of derived types. A derived type can be used as the argument for the "type" statement.

YANG Example:

typedef percent {

type uint8 {

range "0 .. 100";

}

description "Percentage";

}

leaf completed {

type percent;

}

YANG statements

A YANG module defines a data model in terms of the data, its hierarchical organization, and the constraints on that data. YANG defines how this data is represented in XML and how that data is used in NETCONF operations. The following table briefly describes some common YANG statements:

Statement

Description

augment

Extends existing data hierarchies

choice

Defines mutually exclusive alternatives

Statement

Description

container

Defines a layer of the data hierarchy

extension

Allows new statements to be added to YANG

feature

Indicates parts of the model that are optional

grouping

Groups data definitions into reusable sets

key

Defines the key leafs for lists

leaf

Defines a leaf node in the data hierarchy

leaf-list

A leaf node that can appear multiple times

list

A hierarchy that can appear multiple times

notification

Defines notification

rpc

Defines input and output parameters for an RPC operation

typedef

Defines a new type

uses

Incorporates the contents of a "grouping"