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 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
NETCONFRESTCONF
TransportSSH, TCP 830HTTPS, TCP 443
EncodingXMLJSON or XML
Operations<get>, <get-config>, <edit-config>, <copy-config>, <delete-config>, <lock>, <commit>GET, POST, PUT, PATCH, DELETE
Datastoresrunning, candidate, startupOne unified datastore
TransactionsLock, validate, commit, roll backPer 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 sessionsOpen NETCONF sessions.
show platform software yang-management processWhether the NETCONF and RESTCONF processes run.
ssh -p 830 admin@10.99.0.11 -s netconfOpen a raw NETCONF session and see the capabilities hello.

Exam traps

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

More topics in 4.0 Network Assurance