YANG can model state data and configuration data based on the "config" statement. If a node is tagged with "config false", its subhierarchy is flagged as state data. If a node is tagged with "config true", its subhierarchy is flagged as configuration data. When state data is queried using NETCONF's <get> operation, parent containers, lists, and key leaf nodes are also reported, providing a specific context for the state data.
In the following example, two leaf nodes are defined for each interface, a configured interface status and an observed speed. The observed speed is not configurable, so it can be returned with NETCONF's <get> operations, but not with <get-config> operations.
container interfaces { list interface { key "name"; leaf name { type string; } leaf status { type boolean; default "true"; } leaf observed-speed { type yang:gauge64; units "bits/second"; config false; } } }