yang-netconf
yang-netconf
The Polaris Yang Infrastructure 16.3 feature facilitates a programmatic and standards-based way of writing
configurations and reading operational data from network devices.
The solution lies in adopting a programmatic and standards-based way of writing configurations to any network
device, replacing the process of manual configuration. Network devices running on Cisco IOS XE support
the automation of configuration for multiple devices across the network using data models. Data models are
developed in a standard, industry-defined language, that can define configuration and state information of a
network.
Cisco IOS XE supports the Yet Another Next Generation (YANG) data modeling language. YANG can be
used with the Network Configuration Protocol (NETCONF) to provide the desired solution of automated and
programmable network operations. NETCONF (RFC 6241) is an XML-based protocol that client applications
use to request information from and make configuration changes to the device. YANG is primarily used to
model the configuration and state data used by NETCONF operations.
In Cisco IOS XE, model-based interfaces interoperate with existing device CLI, Syslog, and SNMP interfaces.
These interfaces are optionally exposed northbound from network devices. YANG is used to model each
protocol based on RFC 6020.
Note To access Cisco YANG models in a developer-friendly way, please clone the GitHub repository https://
github.com/YangModels/yang, and visit the vendor/cisco
(https://github.com/YangModels/yang/tree/master/vendor/cisco) subdirectory. Models for various release
of IOS-XE, IOS-XR, and NX-OS platforms are available here.
NETCONF
NETCONF provides a simpler mechanism to install, manipulate, and delete the configuration of network
devices.
It uses an Extensible Markup Language (XML)-based data encoding for the configuration data as well as the
protocol messages.
NETCONF uses a simple RPC-based (Remote Procedure Call) mechanism to facilitate communication between
a client and a server. The client can be a script or application typically running as part of a network manager.
The server is typically a network device (switch or router). It uses Secure Shell (SSH) as the transport layer
across network devices.
NETCONF also supports capability discovery and model downloads. Supported models are discovered using
the ietf-netconf-monitoring model. Revision dates for each model are shown in the capabilities response. Data
models are available for optional download from a device using the get-schema rpc. You can use these YANG
models to understand or export the data model.
For more details, refer RFC 6241.
Configuring NETCONF
Before You Begin
You must configure AAA in the IOS-XE device before configuring the NETCONF as follows:
• aaa new-model
• aaa authentication login default local
SUMMARY STEPS
1. enable
2. configure terminal
3. netconf-yang
4. exit
DETAILED STEPS
Example:
Device# configure terminal
Example:
Device (config)# exit
Configuring SNMP
Enable the SNMP Server in IOS to enable NETCONF to access SNMP MIB data using YANG models
generated from supported MIBs, and to enable supported SNMP traps in IOS to receive NETCONF notifications
from the supported traps.
Perform the following steps:
SUMMARY STEPS
DETAILED STEPS
Example:
configure terminal
logging history debugging
logging snmp-trap emergencies
logging snmp-trap alerts
logging snmp-trap critical
logging snmp-trap errors
logging snmp-trap warnings
logging snmp-trap notifications
logging snmp-trap informational
logging snmp-trap debugging
!
snmp-server community public RW
snmp-server trap link ietf
snmp-server enable traps snmp authentication linkdown linkup snmp-server enable traps syslog
snmp-server manager
exit
Step 2 After NETCONF-YANG starts, enable SNMP Trap support by sending the following RPC <edit-config> message to
the NETCONF-YANG port.
Example:
<?xml version="1.0" encoding="utf-8"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="">
<edit-config>
<target>
<running/>
</target>
<config>
<netconf-yang xmlns="http://cisco.com/yang/cisco-self-mgmt">
<cisco-ia xmlns="http://cisco.com/yang/cisco-ia">
<snmp-trap-control>
<trap-list>
<trap-oid>1.3.6.1.4.1.9.9.41.2.0.1</trap-oid>
</trap-list>
<trap-list>
<trap-oid>1.3.6.1.6.3.1.1.5.3</trap-oid>
</trap-list>
<trap-list>
<trap-oid>1.3.6.1.6.3.1.1.5.4</trap-oid>
</trap-list>
</snmp-trap-control>
</cisco-ia>
</netconf-yang>
</config>
</edit-config>
</rpc>
Step 3 Send the following RPC message to the NETCONF-YANG port to save the running configuration to the startup
configuration.
Example:
<?xml version="1.0" encoding="utf-8"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="">
<cisco-ia:save-config xmlns:cisco-ia="http://cisco.com/yang/cisco-ia"/>
</rpc>
SUMMARY STEPS
1. After NETCONF-YANG starts, send the following RPC <edit-config> message to the NETCONF-YANG
port.
2. Send the following RPC message to the NETCONF-YANG port to save the running configuration to the
startup configuration.
DETAILED STEPS
Step 1 After NETCONF-YANG starts, send the following RPC <edit-config> message to the NETCONF-YANG port.
Example:
<?xml version="1.0" encoding="utf-8"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="">
<edit-config>
<target>
<running/>
</target>
<config>
<netconf-yang xmlns="http://cisco.com/yang/cisco-self-mgmt">
<cisco-odm xmlns="http://cisco.com/yang/cisco-odm">
<polling-enable>true</polling-enable>
<on-demand-default-time>30000</on-demand-default-time>
<on-demand-enable>false</on-demand-enable>
<actions>
<action-name>parse.showACL</action-name>
<polling-interval>120000</polling-interval>
<mode>poll</mode>
</actions>
<actions>
<action-name>parse.showArchive</action-name>
<polling-interval>120000</polling-interval>
<mode>poll</mode>
</actions>
<actions>
<action-name>parse.showEnvironment</action-name>
<polling-interval>120000</polling-interval>
<mode>poll</mode>
</actions>
<actions>
<action-name>parse.showFlowMonitor</action-name>
<polling-interval>120000</polling-interval>
<mode>poll</mode>
</actions>
<actions>
<action-name>parse.showInterfaces</action-name>
<polling-interval>120000</polling-interval>
<mode>poll</mode>
</actions>
<actions>
<action-name>parse.showIpRoute</action-name>
<polling-interval>120000</polling-interval>
<mode>poll</mode>
</actions>
<actions>
<action-name>parse.showMemoryStatistics</action-name>
<polling-interval>120000</polling-interval>
<mode>poll</mode>
</actions>
<actions>
<action-name>parse.showPlatformSoftware</action-name>
<polling-interval>120000</polling-interval>
<mode>poll</mode>
</actions>
<actions>
<action-name>parse.showProcessesCPU</action-name>
<polling-interval>120000</polling-interval>
<mode>poll</mode>
</actions>
<actions>
<action-name>parse.showProcessesMemory</action-name>
<polling-interval>120000</polling-interval>
<mode>poll</mode>
</actions>
</cisco-odm>
</netconf-yang>
</config>
</edit-config>
</rpc>
The <edit-config> can be modified to enable or disable specific actions and/or to choose a different update frequency.
Step 2 Send the following RPC message to the NETCONF-YANG port to save the running configuration to the startup
configuration.
Example:
<?xml version="1.0" encoding="utf-8"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="">
<cisco-ia:save-config xmlns:cisco-ia="http://cisco.com/yang/cisco-ia"/>
</rpc>
Additional References
Related Documents
Standard/RFC Title
RFC 6020 YANG - A Data Modeling Language for the Network
Configuration Protocol (NETCONF)
Technical Assistance
Description Link
The Cisco Support and Documentation website http://www.cisco.com/cisco/web/support/index.html
provides online resources to download documentation,
software, and tools. Use these resources to install and
configure the software and to troubleshoot and resolve
technical issues with Cisco products and technologies.
Access to most tools on the Cisco Support and
Documentation website requires a Cisco.com user ID
and password.