- YANG is defined in RFC 6020
- defines hierarhy of data, structures data models in to modules and submodules
- used to model data for NETCONF
- permits the definition of reusable groupings of nodes
- RFC 6021 - describes common YANG types used in networking
these can be imported with import statment:
import "ietf-yang-types" {
prefix-yang;
}
- then as a reference when accessing definitions use "yang" as a prefix i.e.:
type yang:port-number
- Four types of nodes are used for data modeling:
a) Leaf node(s) - smallest component, one value i.e. ipv4 address
b) Leaf-list - a sequence of leaf nodes with exactly one value of a
particular type per leaf
c) Container nodes - group related nodes in a subtree
d) List nodes - defines a sequence of list entries
- examples of build-in YANG data types:
a) binary
b) bits
c) boolean
d) decimal64
e) int8/16/32/64
f) uint8/16/32/64
g) empty
h) string
- Derived Types (typedef)
"typedef" statment can be used to define derived types, example:
typedef listen-port {
type uint16 {
range "65520 .. 65530";
}
description "open ports for testing"
}
Derived type statments:
a) default
b) description
c) status
d) reference
e) type
f) units
- augment - is to add new schema nodes to a previously defined schema node