Using Data Models

Using data models involves three tasks:

Obtain Data Models

The data models are available in the mgbl pie software package. Installing a package on the router installs specific features that are part of that package. Cisco IOS XR software is divided into various software packages to select the features to run on the router. Each package contains components that perform a specific set of router functions, such as routing, security, and so on.

Pre-requisites:

Ensure that the mgbl pie software image is loaded in the router.

  1. Verify that the data models are available using netconf-monitoring request.
    
    <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
     <get>
       <filter type="subtree">
         <netconf-state xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring">
         <schemas/>
         </netconf-state>
       </filter>
     </get>
    </rpc>
    
    All IOS XR YANG models are displayed.

The YANG models can be retrieved from the router without logging into the router using get-schema command:

Get Schema List (data will be used in step 2).
<get>
<filter type="subtree">
<netconf-state xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring">
<schemas/>
</netconf-state>
</filter>
</get>
</rpc>
All the models on the router are displayed.
TRACE: 2016/06/13 11:11:42 transport.go:104: Reading from connection
TRACE: 2016/06/13 11:11:42 gnc_main.go:587: Session established (Id: 1009461378)
TRACE: 2016/06/13 11:11:42 session.go:93: Request:
<rpc message-id="16a79f87-1d47-4f7a-a16a-9405e6d865b9" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><get><filter type="subtree"><netconf-state xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring"><schemas/></netconf-state></filter></get></rpc>
TRACE: 2016/06/13 11:11:42 transport.go:104: Reading from connection
TRACE: 2016/06/13 11:11:42 session.go:117: 
Response:
#143589
<rpc-reply message-id="16a79f87-1d47-4f7a-a16a-9405e6d865b9" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<data>
<netconf-state xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring">
<schemas>
<schema>
<identifier>Cisco-IOS-XR-crypto-sam-oper</identifier>
<version>2015-01-07</version>
<format>yang</format>
<namespace>http://cisco.com/ns/yang/Cisco-IOS-XR-crypto-sam-oper</namespace>
<location>NETCONF</location>
</schema>
<schema>
<identifier>Cisco-IOS-XR-crypto-sam-oper-sub1</identifier>
<version>2015-01-07</version>
<format>yang</format>
<namespace>http://cisco.com/ns/yang/Cisco-IOS-XR-crypto-sam-oper</namespace>
<location>NETCONF</location>
</schema>
<schema>
<identifier>Cisco-IOS-XR-snmp-agent-oper</identifier>
<version>2015-10-08</version>
<format>yang</format>
<namespace>http://cisco.com/ns/yang/Cisco-IOS-XR-snmp-agent-oper</namespace>
<location>NETCONF</location>
</schema>
------------<truncated>--------------

For more information about structure of data models, see YANG Module.

What To Do Next:

Enable the protocol to establish connection between the router and the client application.

Enable Protocol

The router communicates with the client application using protocols. On the router and client application, enable the NETCONF communication protocol.

For more information about protocols, see Communication Protocols.

Enable NETCONF over SSH Protocol

NETCONF is an XML-based protocol used over Secure Shell (SSH) transport to configure a network. The client applications use this protocol to request information from the router, and make configuration changes to the router.

For more information about NETCONF, see NETCONF Protocol.

Pre-requisites:

  • Software package k9sec pie is installed on the router.

  • Software package mgbl pie is installed on the router.

  • Crypto keys are generated.

To enable the NETCONF protocol, complete these steps:

  1. Enable NETCONF protocol over an SSH connection.
    
    ssh server v2
    ssh server netconf
    netconf agent tty
    netconf-yang agent ssh
    
    The default port number of 830 is used. A different port within the range of 1 to 65535 can be specified if required.
  2. Set the session parameters.
    router (config)# netconf-yang agent session {  limit value |  absolute-timeout value |  idle-timeout value }
    where:
    • limit value: sets the maximum count for concurrent netconf-yang sessions. The range is from 1 to 1024.

    • absolute-timeout value: sets the absolute session lifetime, in minutes. The range is from 1 to 1440.

    • idle-timeout value: sets the idle session lifetime, in minutes. The range is from 1 to 1440.

  3. Verify configuration settings for statistics and clients.
    router (config)# do show netconf-yang statistics
    router (config)# do show netconf-yang clients

Enable NETCONF


config
netconf-yang agent ssh
ssh server netconf port 830
!

Verify Configuration Using Statistics

After the NETCONF request is sent, use do show netconf-yang statistics command to verify the configuration.

show netconf-yang statistics
Summary statistics        requests|             total time|   min time per request|   max time per request|   avg time per request|
other                             0|       0h  0m  0s   0ms|       0h  0m  0s   0ms|       0h  0m  0s   0ms|       0h  0m  0s   0ms|
close-session                     4|       0h  0m  0s   3ms|       0h  0m  0s   0ms|       0h  0m  0s   1ms|       0h  0m  0s   0ms|
kill-session                      0|       0h  0m  0s   0ms|       0h  0m  0s   0ms|       0h  0m  0s   0ms|       0h  0m  0s   0ms|
get-schema                        0|       0h  0m  0s   0ms|       0h  0m  0s   0ms|       0h  0m  0s   0ms|       0h  0m  0s   0ms|
get                               0|       0h  0m  0s   0ms|       0h  0m  0s   0ms|       0h  0m  0s   0ms|       0h  0m  0s   
get-config                        1|       0h  0m  0s   1ms|       0h  0m  0s   1ms|       0h  0m  0s   1ms|       0h  0m  0s   1ms|
edit-config                       3|       0h  0m  0s   2ms|       0h  0m  0s   0ms|       0h  0m  0s   1ms|       0h  0m  0s   0ms|
commit                            0|       0h  0m  0s   0ms|       0h  0m  0s   0ms|       0h  0m  0s   0ms|       0h  0m  0s   0ms|
cancel-commit                     0|       0h  0m  0s   0ms|       0h  0m  0s   0ms|       0h  0m  0s   0ms|       0h  0m  0s   0ms|
lock                              0|       0h  0m  0s   0ms|       0h  0m  0s   0ms|       0h  0m  0s   0ms|       0h  0m  0s   0ms|
unlock                            0|       0h  0m  0s   0ms|       0h  0m  0s   0ms|       0h  0m  0s   0ms|       0h  0m  0s   0ms|
discard-changes                   0|       0h  0m  0s   0ms|       0h  0m  0s   0ms|       0h  0m  0s   0ms|       0h  0m  0s   0ms|
validate                          0|       0h  0m  0s   0ms|       0h  0m  0s   0ms|       0h  0m  0s   0ms|       0h  0m  0s   0ms|

Verify Configuration Using Clients


show netconf-yang clients
client session ID|   NC version|    client connect time|        last OP time|        last OP type|    <lock>|
22969|                  1.1|         0d  0h  0m  2s|             11:11:24|           close-session|     No|

What To Do Next:

After NETCONF is enabled, use the YANG data models to manage the relevant configurations.

Manage Configurations using Data Model

From the client application, use data models to manage the configurations of the router.

Prerequisites

  • Software packages k9sec pie and mgbl are installed on the router.

  • NETCONF enabled on the client and the router.

To manage configurations using data models, complete these steps:
  1. Use a YANG tool to import the data model on the client application.

  2. Configure the router by modifying the values of the data model using the YANG tool.

For more information on the values of the data models that can be configured, see Structure of YANG Models.


Note


The OC interface maps all IP configurations for parent interface under a VLAN with index 0. This restricts configuring a sub interface with tag 0.


Example: Configure CDP

In this example, you use the data model for CDP and configure CDP with the values as shown in the table:

CDP parameter

Description

Desired value for parameter

CDP Version

Specifies the version used to communicate with the neighboring devices

v1

Hold time

Specifies the duration for which the receiving device to hold the CDP packet

200 ms

Timer

Specifies how often the software sends CDP updates

80 ms

Log Adjacency Table

Logs changes in the adjacency table. When CDP adjacency table logging is enabled, a syslog is generated each time a CDP neighbor is added or removed

enable

  1. Download the configuration YANG data model for CDP Cisco-IOS-XR-cdp-cfg.yang from the router. To download the data model, see Obtain Data Models.

  2. Import the data model to the client application using any YANG tool.

  3. Modify the leaf nodes of the data model:

    • enable (to enable cdp)

    • holdtime

    • timer

    • advertise v1 only

    • log adjacency

Configure CDP Using NETCONF

In this example, you use the data model for CDP and configure CDP using NETCONF RPC request:


<edit-config>
  <target>
   <candidate/>
  </target>
  <config xmlns:xc="urn:ietf:params:xml:n:netconf:base:1.0">
   <cdp xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-cdp-cfg">
   <timer>80</timer>
   <enable>true</enable>
   <log-adjacency></log-adjacency>
   <hold-time>200</holdtime>
   <advertise-v1-only></advertise-v1-only>
  </cdp>
 </config>
</edit-config>

Note


CDP can also be configured under the interface configuration by augmenting the interface manager. Use the Cisco-IOS-XR-ifmgr-cfg YANG model to configure CDP under the interface configuration.