4.6 Configure and verify NETCONF and RESTCONF
ENCOR 350-401 v1.2 · 4.0 Network Assurance
NETCONF and RESTCONF are programmatic interfaces to a device's configuration and state, both built on YANG data models. NETCONF uses XML over SSH (port 830) with RPC operations and candidate datastores; RESTCONF uses HTTP verbs over HTTPS with JSON or XML. ENCOR expects you to enable and use both on IOS XE.
What you must know
- Enable NETCONF and RESTCONF on IOS XE, with AAA and HTTPS.
- Compare NETCONF and RESTCONF: transport, encoding, operations, datastores.
- Read a RESTCONF URI built from a YANG path.
- Name NETCONF operations: get, get-config, edit-config, lock, commit.
Enable and compare
aaa new-model
aaa authentication login default local
aaa authorization exec default local
username admin privilege 15 secret Adm1n!
!
netconf-yang
ip http secure-server
restconf| NETCONF | RESTCONF | |
|---|---|---|
| Transport | SSH, TCP 830 | HTTPS, TCP 443 |
| Encoding | XML | JSON or XML |
| Operations | <get>, <get-config>, <edit-config>, <copy-config>, <delete-config>, <lock>, <commit> | GET, POST, PUT, PATCH, DELETE |
| Datastores | running, candidate, startup | One unified datastore |
| Transactions | Lock, validate, commit, roll back | Per request |
A RESTCONF request
GET https://10.99.0.11/restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet1
Accept: application/yang-data+json
200 OK
{"ietf-interfaces:interface": {"name": "GigabitEthernet1", "type": "iana-if-type:ethernetCsmacd", "enabled": true}}The script reads the interface with RESTCONF (1) and edits it with NETCONF, which replies <ok/> when the change is applied (2). Both use the same YANG models, so the data is identical; only the transport and encoding differ.
Commands
show netconf-yang sessions | Open NETCONF sessions. |
show platform software yang-management process | Whether the NETCONF and RESTCONF processes run. |
ssh -p 830 admin@10.99.0.11 -s netconf | Open a raw NETCONF session and see the capabilities hello. |
Exam traps
- NETCONF uses SSH on port 830; RESTCONF uses HTTPS on 443.
- RESTCONF's content type is
application/yang-data+json(or+xml). - Only NETCONF has a candidate datastore and commit.
- Both need a privilege-15 user (AAA) on IOS XE.
Check yourself
- Which protocol and port does NETCONF use?
- SSH on TCP 830.
- Which HTTP verb changes part of a resource in RESTCONF?
- PATCH.
- What lets NETCONF validate a change before applying it?
- The candidate datastore with validate and commit.
Labs
Try it live: Automate the router: RESTCONF, NETCONF, JSON and EEM