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
- 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.
| Device | Interface | Address | Notes |
|---|---|---|---|
| devbox | eth0 | 10.10.20.10/24 | workstation, ncclient 0.6.13 |
| xe1 | Gi1 | 10.10.20.21/24 | IOS XE 17.3, NETCONF on TCP 830 |
| xe1 | Gi2 | to configure: 10.1.13.2/30 | link to r1 |
| xe1 | Loopback0 | to configure: 10.255.0.3/32 | router ID |
| r1 | Gi0/2 | 10.1.13.1/30 | already 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
- Talk NETCONF by hand
- Open a session with ncclient and read the capabilities
- Read configuration and state with filters
- Change configuration with edit-config
- Handle errors, and know delete from remove
- Use the Cisco native model
- Commit through the candidate datastore
- 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.
Every link, as text
- devbox
eth0to Mgmt (network) - xe1
Gi1to Mgmt (network) - r1
Gi0/0to Mgmt (network) - xe1
Gi2to r1Gi0/2
| Node | Device | Image in Add Node | Set to |
|---|---|---|---|
| devbox | EVE-NG GUI server (Docker) | eve-gui-server:latest | 1 vCPU, 1,024 MB |
| xe1 | Cisco CSR 1000v | csr1000vng-universalk9.17.03.08a-serial | 1 vCPU, 4,096 MB |
| r1 | Cisco IOSv | vios-adventerprisek9-m.spa.159-3.m9 | 1 vCPU, 512 MB |
How to open this lab
Sign in to your workspace at
lab.cloudlabbox.com.In File Manager, open Shared, then the folder
Network Automation - CCNA and CCNP Automation guided labs.Open
09 - NETCONF with ncclient - read change and commit IOS XE configurationand 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
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.