Overview
Traditional network management relies heavily on the Command-Line Interface (CLI), where administrators manually configure routers and switches using commands.
While CLI-based management is effective, managing hundreds or thousands of network devices individually can be time-consuming and prone to configuration errors.
Modern enterprise networks increasingly use automation tools, APIs, and structured data models to simplify network configuration and monitoring.
Two important technologies used for model-driven network management are NETCONF (Network Configuration Protocol) and RESTCONF (REST Configuration Protocol).
Both protocols allow network automation applications to communicate with network devices using standardized interfaces and structured data models, particularly YANG.
NETCONF primarily uses XML-based Remote Procedure Calls (RPCs) over SSH, while RESTCONF provides an HTTP-based interface commonly using JSON or XML.
This lesson explains the concepts, architecture, differences, Cisco IOS XE configuration, practical examples, Python automation, verification, troubleshooting, and real-world use cases of NETCONF and RESTCONF.
Learning Objectives
By the end of this lesson, you will be able to:
Explain the purpose of NETCONF and RESTCONF.
Understand the limitations of traditional CLI-based management.
Describe model-driven network programmability.
Explain the relationship between YANG, NETCONF, and RESTCONF.
Identify NETCONF and RESTCONF transport protocols and default ports.
Understand NETCONF datastores and operations.
Explain RESTCONF HTTP methods and status codes.
Configure NETCONF and RESTCONF on supported Cisco IOS XE devices.
Retrieve device information using NETCONF and RESTCONF.
Understand basic Python automation using
ncclientandrequests.Compare NETCONF, RESTCONF, SSH, and SNMP.
Troubleshoot common model-driven management problems.
Training objective: By the end of this lesson, a learner should be able to explain the NETCONF/RESTCONF/YANG relationship, enable the services on Cisco IOS-XE, retrieve configuration, apply a change and verify the result. |
1. Introduction to Network Programmability
Network programmability refers to managing and interacting with network infrastructure through software, APIs, and structured data rather than relying exclusively on manual CLI commands.
For example, consider an enterprise with 200 Cisco switches.
An administrator needs to change the description of an interface across 50 switches.
Traditional CLI Approach
The administrator connects to each switch and enters commands. This process must be repeated for each device unless scripts or other automation tools are used.
Model-Driven Approach
An automation application can communicate with supported devices using NETCONF or RESTCONF, read their current configuration, and apply structured changes.
Benefits include:
Consistent configuration across devices.
Reduced manual intervention.
Easier integration with automation platforms.
Structured configuration validation.
Programmatic retrieval of operational data.
Improved scalability.
More predictable configuration workflows.
Important: NETCONF and RESTCONF do not automatically configure devices. They provide standardized management interfaces that automation applications can use.
2. What Is Model-Driven Programmability?
Model-driven programmability uses structured data models to define how network configuration and operational information is represented.
Instead of relying on text commands and manually interpreting CLI output, applications exchange structured data according to defined schemas.
The most widely associated modeling language is YANG.
Basic Architecture
How It Works
A network automation client connects to a network device.
The client uses NETCONF or RESTCONF to request data or configuration changes.
YANG models define the structure and validity of the requested information.
The device processes the request.
The device returns structured data or an operation result.
3. About NETCONF, RESTCONF and YANG
3.1 NETCONF
IETF network management protocol (RFC 6241).
Normally transported over SSH on TCP port 830.
Uses XML-encoded RPC requests and XML replies.
Works with configuration datastores and operational data exposed by the device.
Common operations include <get>, <get-config>, <edit-config>, <copy-config>, <delete-config>, <lock> and <unlock>.
Advanced transactional features depend on server capabilities; for example, a candidate datastore and commit workflow are used only when advertised by the device.
NETCONF Architecture
NETCONF uses two primary components:
NETCONF Client:
