12 YANG Data Modeling Explained
1. YANG Overview
YANG (Yet Another Next Generation) is a data modeling language used to model configuration data, state data, remote procedure calls, and notifications for network management protocols such as NETCONF and RESTCONF.
Example: Think of YANG as a blueprint for a house. Just as a blueprint defines the structure and layout of a house, YANG defines the structure and layout of network data.
2. Modules and Submodules
YANG models are organized into modules and submodules. A module is a top-level container for YANG definitions, while submodules are smaller, reusable components that can be included in modules.
Example: Consider a module as a book and submodules as chapters within the book. Each chapter (submodule) can be read independently, but they all contribute to the overall story (module).
3. Data Nodes
Data nodes are the building blocks of YANG models. They represent individual pieces of data, such as configuration settings or operational state information.
Example: Think of data nodes as individual pieces of furniture in a house. Each piece (data node) serves a specific purpose and contributes to the overall functionality of the house (YANG model).
4. Containers
Containers are YANG data nodes that group related data nodes together. They provide a hierarchical structure to the data model.
Example: Consider a container as a room in a house. Just as a room contains furniture (data nodes), a container groups related data nodes together.
5. Lists
Lists are YANG data nodes that represent collections of similar data items. They are used to model data that can have multiple instances.
Example: Think of a list as a bookshelf with multiple books. Each book (data item) is an instance of the list, and the bookshelf (list) holds all the books together.
6. Leafs
Leafs are YANG data nodes that represent simple data values, such as strings, integers, or booleans. They are the terminal nodes in a YANG model.
Example: Consider a leaf as a single lightbulb in a house. Just as a lightbulb provides light, a leaf provides a simple data value in the YANG model.
7. Leaf-Lists
Leaf-lists are similar to leafs, but they can have multiple instances. They are used to model data that can have multiple values.
Example: Think of a leaf-list as a string of lights. Each light (value) is an instance of the leaf-list, and the string (leaf-list) holds all the lights together.
8. Groupings
Groupings are reusable sets of data nodes that can be included in multiple places within a YANG model. They help in reducing redundancy and improving modularity.
Example: Consider a grouping as a reusable blueprint for a room. Just as a room blueprint can be used in multiple houses, a grouping can be used in multiple parts of a YANG model.
9. RPCs (Remote Procedure Calls)
RPCs are YANG data nodes that define operations that can be invoked on a network device. They are used to model actions that can be performed on the device.
Example: Think of an RPC as a remote control for a TV. Just as a remote control can perform actions like changing channels, an RPC can perform actions on a network device.
10. Notifications
Notifications are YANG data nodes that define events that can be sent by a network device. They are used to model asynchronous events and alerts.
Example: Consider a notification as an alarm system in a house. Just as an alarm system sends alerts when triggered, a notification sends alerts when an event occurs on a network device.
11. Augmentations
Augmentations allow you to extend existing YANG models by adding new data nodes to them. They are used to customize and extend standard models.
Example: Think of an augmentation as an addition to a house. Just as an addition can extend the functionality of a house, an augmentation can extend the functionality of a YANG model.
12. Deviations
Deviations are used to modify or restrict the behavior of existing YANG models. They are used to adapt standard models to specific requirements.
Example: Consider a deviation as a modification to a blueprint. Just as a modification can change the design of a house, a deviation can change the behavior of a YANG model.