Pcornel
Automation · RESTCONF

YANG Data

Cheat sheet · https://pcornel.dk/topic.php?topic=5619

Back to the Topic

Answer

YANG data in RESTCONF is addressed by the YANG tree path in the URI, such as /data/Cisco-IOS-XE-native:native/hostname, so the YANG model defines which URIs and fields exist.

Remember

  • URI follows module:container/list=key.
  • Model defines valid paths.
  • Check model support on device.

First checks

  • curl -s --cacert ca.pem -u <u>:<p> -H 'Accept: application/yang-data+json' 'https://<dev>/restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet1' — one list entry
  • URL-encode keys with / or : — encoding
  • ?depth / ?fields query — limit response

Verify in this order

URL path → YANG node → JSON/XML

Where it usually breaks

Client payload/auth → HTTP transport → endpoint validation/policy → request accepted → queued/job execution → target mutation → effective state → consumer workload.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5619

Confirmation

Confirm action

Continue?