When building YANG models, the import statement can
be used to make all these data types available in the new
model:
import "ietf-yang-types" {
prefix yang;
}
When importing an external YANG module, the prefix
statement defines the prefix that will be used when
accessing definitions inside the imported module. For
example, in order to reference the IPv4 address data type
from the newly imported ietf-yang-types module, you
can use the following statement:
type yang:ipv4-address;
YANG defines four types of nodes for data modeling:
Leaf nodes
Leaf-list nodes
Container nodes
List nodes
The simplest component of a YANG module is the leaf
node. A leaf node has one value of a specific type. The
following definition of an interface name is an example
of a leaf node:
Click here to view code image
leaf intf-name {
type string;
description "The name of the interface";
}