Network automation lab 9 of 27

NETCONF with ncclient: read, change and commit IOS XE configuration

Speak NETCONF by hand over SSH, then with Python's ncclient: read configuration and state with filters, change interfaces and NTP with edit-config, handle rpc-errors and the delete/remove operations, commit through the candidate datastore, and save.

Run this lab

It needs Lite: its 3 nodes are set to 3 vCPU and 5,632 MB in total. That fits the free demo too.

In your workspace: Shared, then Network Automation - CCNA and CCNP Automation guided labs, then 09 - NETCONF with ncclient - read change and commit IOS XE configuration

Try it free for 30 minutesRun it on Lite from £3 a day

The free demo needs no card and no email. Every lab plan includes every guided lab.

Level
Intermediate
Time
About 85 minutes
Nodes need
3 vCPU, 5,632 MB
Smallest plan
Lite

The scenario

Kestrel Freight is moving its IOS XE routers from screen-scraping to model-driven management. The WAN router xe1 already has NETCONF enabled. Your job is to prove the team can do everything they used to do over the CLI, but with structured data: see what the router supports, read its configuration and state, configure its loopback, its link to the branch router r1 and its NTP server, deal properly with errors, make a change through the candidate datastore, and save. r1 is already configured on its side of the link (10.1.13.1/30), so a ping proves your change works.

DeviceInterfaceAddressNotes
devboxeth010.10.20.10/24workstation, ncclient 0.6.13
xe1Gi110.10.20.21/24IOS XE 17.3, NETCONF on TCP 830
xe1Gi2to configure: 10.1.13.2/30link to r1
xe1Loopback0to configure: 10.255.0.3/32router ID
r1Gi0/210.1.13.1/30already configured

Files in ~/lab: nclab.py (a connect() helper and a namespace map) and raw/session.xml (a hand-written NETCONF session). Login netops / NetOps-Lab1 ($NET_USER, $NET_PASS).

What you’ll practise

  • Explain the NETCONF layers (SSH transport, messages, operations, content) and the hello exchange
  • Read configuration with get-config and state with get, using subtree filters
  • Change configuration with edit-config, using IETF and Cisco native YANG models
  • Interpret rpc-errors and use the merge, delete and remove operations correctly
  • Use the candidate datastore with lock, validate, commit and discard-changes, and save the configuration

The tasks

  1. Talk NETCONF by hand
  2. Open a session with ncclient and read the capabilities
  3. Read configuration and state with filters
  4. Change configuration with edit-config
  5. Handle errors, and know delete from remove
  6. Use the Cisco native model
  7. Commit through the candidate datastore
  8. Save the configuration

The Lab Tasks pane has the scenario, these tasks, the checks to run, hints and the full solution.

Topology and devices

The network as it opens in EVE-NG, drawn from the lab’s own canvas, and the image each node runs.

Topology of NETCONF with ncclient - read change and commit IOS XE configuration3 nodes and 1 network, 4 links. Every link is listed as text below the diagram.devboxxe1r1Mgmteth0Gi2Gi0/2Gi1Gi0/0
3 nodes and 1 network, with the interface names each link uses. On a narrow screen, scroll the diagram sideways.
Nodes in NETCONF with ncclient: read, change and commit IOS XE configuration, with the image each runs and the vCPU and RAM it’s set to
NodeDeviceImage in Add NodeSet to
devboxEVE-NG GUI server (Docker)eve-gui-server:latest1 vCPU, 1,024 MB
xe1Cisco CSR 1000vcsr1000vng-universalk9.17.03.08a-serial1 vCPU, 4,096 MB
r1Cisco IOSvvios-adventerprisek9-m.spa.159-3.m91 vCPU, 512 MB

How to open this lab

  1. Sign in to your workspace at lab.cloudlabbox.com.

  2. In File Manager, open Shared, then the folder Network Automation - CCNA and CCNP Automation guided labs.

  3. Open 09 - NETCONF with ncclient - read change and commit IOS XE configuration and start its nodes, then open Lab Tasks for the scenario and the steps.

The lab is read-only. You can start the nodes and configure the devices, but changes to the topology can’t be saved. To change it, rebuild it in your own folder.

More Network automation labs

All Network automation labs

Related labs in other courses

CloudLabBox is independent of Cisco. The lab follows exam topics and isn’t vendor training material; vendor names identify the exams and the images in the workspace.