📘Cisco DevNet Associate (200-901 DEVASC)
1. What is YANG?
- YANG stands for Yet Another Next Generation.
- It is a data modeling language used to describe network device configurations and state data in a structured way.
- Think of it as a blueprint or schema that defines what data a network device can store and how it is organized.
- YANG is mainly used with NETCONF and RESTCONF to automate network management.
Key idea: YANG is not the actual data, it describes the structure of the data that can be sent to or received from network devices.
2. Why YANG is Important in Networking
- Allows automation tools (like Python scripts, Ansible, or Cisco DNA Center) to understand what data they can configure or read from a device.
- Provides consistency in how devices represent data.
- Makes it easier to validate and check network configurations automatically.
Example in IT: A YANG model can define the exact structure for a router interface configuration:
- Interface name
- IP address
- Subnet mask
- Status (up/down)
Automation tools will read the YANG model to know exactly what fields are required and what data is allowed.
3. YANG Data Model Structure
YANG models define data in a hierarchical (tree-like) structure, similar to folders and files on a computer.
Key Components of a YANG Model
- Module
- A YANG file starts with a module.
- The module gives a name and version for the set of configurations it defines.
- Example:
module cisco-interfaces { ... }
- Container
- A container groups related data together (like a folder for related settings).
- Example:
interfacescontainer holds all interface configurations.
- Leaf
- A leaf is an individual piece of data (like a file in a folder).
- Example:
name,ip-address,description.
- Leaf-list
- A list of multiple leaves with the same type.
- Example: multiple DNS server IP addresses for a router.
- List
- A list contains multiple containers of the same type.
- Example: a list of interfaces, where each interface has
name,IP, andstatus.
- Choice and Case
- Provides optional alternatives.
- Example: an interface can have either a static IP configuration or a DHCP configuration.
- Type
- Defines the data type for a leaf or leaf-list.
- Examples:
string,int32,boolean,enumeration.
- Augment
- Allows extending existing models with additional data.
- Useful when you need extra configurations not originally defined.
4. Understanding YANG through a Device Configuration Example
Imagine you want to configure interfaces on a network switch.
YANG Model (simplified):
module cisco-interfaces {
container interfaces {
list interface {
leaf name { type string; }
leaf ip-address { type string; }
leaf status { type enumeration { enum up; enum down; } }
}
}
}
- Module:
cisco-interfaces→ defines interface settings. - Container:
interfaces→ groups all interfaces. - List:
interface→ multiple interfaces allowed. - Leaf:
name,ip-address,status→ actual settings for each interface. - Type: string or enumeration → defines allowed values.
Automation tools can read this model and know:
- You must provide a name for the interface.
- Status can only be
upordown. - Multiple interfaces can be configured in a list.
5. Key YANG Concepts for the Exam
| Concept | What it Means | Example in IT |
|---|---|---|
| Module | A YANG file containing a set of configurations | cisco-interfaces |
| Container | Groups related configurations | interfaces container |
| Leaf | Single data element | ip-address |
| Leaf-list | Multiple entries of the same type | Multiple DNS servers |
| List | A collection of containers | Multiple router interfaces |
| Type | Defines data type | string, boolean, enumeration |
| Choice/Case | Optional alternatives | Static IP OR DHCP |
| Augment | Extending an existing model | Adding extra QoS settings |
6. How YANG is Used in IT Automation
- NETCONF and RESTCONF use YANG models to interact with devices.
- Automation tools read YANG models to:
- Know which fields are required.
- Validate configuration data.
- Ensure the data format is correct before sending it to the device.
Example workflow:
- RESTCONF request is made to configure an interface.
- YANG model defines which data is allowed (
name,ip-address,status). - Automation tool checks data against YANG model.
- Configuration is applied if valid, or rejected if invalid.
7. Tips for the Exam
- Remember: YANG describes data structure, not actual configuration.
- Know common YANG statements:
module,container,list,leaf,type. - Understand hierarchical structure of YANG models.
- Be able to interpret small YANG snippets to identify what data is defined and required.
- Focus on interfaces, IP addresses, and status fields — these are commonly used examples in the exam.
✅ Summary:
- YANG is the blueprint for network configurations.
- It helps automation tools understand and validate device data.
- Key elements: module, container, list, leaf, leaf-list, type, choice, augment.
- Being able to read and interpret YANG models is essential for automation and network programmability tasks.
