As|I|was going through email received over my end-of-2020 break, I came across a great question. Or more accurately, a greatset of questions all related to the cornucopia of YANG models available to network automation engineers.
As I dive deeper into YANG models, I am realizing that there are two ways for networking YANG models: the OpenConfig and the IETF. What I've read is that vendors implement natively the OpenConfig model, but they also build the IETF model to be compliant with the IETF. Is that right? Are these two models working in (all) Cisco devices? Will OpenConfig model converge with the IEFT model in a relatively near future? What is (really) the Cisco approach about this?
Man, what a great set of questions. Let's dive into them.
YANG models either come fromVendorsor from some "Other Group". Vendors are companies like Cisco who make hardware and software products. "Other Groups" could be referred to as "Standards Bodies" but not all groups creating YANG models are technically Standards Bodies so we'll go with the totally generic "Other Groups" name here.
Models created by Vendors are often referred to as "Native" models -as in they areNativeto the devices/software for which they are associated with.
IETF and OpenConfig are two "Other Groups" that create YANG models. They are different groups with different members and goals. IETF is a standards body that builds models through the same process that brings other IETF standards (YANG, NETCONF, and RESTCONF are all IETF Standards). OpenConfig is a group of network operators, primarily from large service providers or web companies, who came together to build a set of YANG models that met their requirements.
Due to pressure from customers as well as interest in working with the wider network ecosystem, vendors will often support models from "Other Groups" in addition to the native models. Think of this like a router supporting RIP, OSPF, BGP, EIGRP all at the same time.
Youwill often find Native, IETF, and OpenConfig models that all target the same basic network feature supported on a single device. There will be differences between them in areas such as:
Note: the IETF and OpenConfig are NOT the only "Other Groups" that create YANG models. For example there is work in the IEEE on YANG standards as well.
Using the DevNet IOS XE Always On Latest Sandbox, we can look at how these models compare when looking at a single network interface.
curl https://sandbox-iosxe-latest-1.cisco.com/restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet1 \ -u developer:C1sco12345 \ --header 'Accept: application/yang-data+json'{ "ietf-interfaces:interface": { "name": "GigabitEthernet1", "description": "MANAGEMENT INTERFACE - DON'T TOUCH ME", "type": "iana-if-type:ethernetCsmacd", "enabled": true, "ietf-ip:ipv4": { "address": [ { "ip": "10.10.20.48", "netmask": "255.255.255.0" } ] }, "ietf-ip:ipv6": {} }}
curl https://sandbox-iosxe-latest-1.cisco.com/restconf/data/openconfig-interfaces:interfaces/interface=GigabitEthernet1?content=config \ -u developer:C1sco12345 \ --header 'Accept: application/yang-data+json' { "openconfig-interfaces:interface": { "name": "GigabitEthernet1", "config": { "name": "GigabitEthernet1", "type": "iana-if-type:ethernetCsmacd", "description": "MANAGEMENT INTERFACE - DON'T TOUCH ME", "enabled": true }, "subinterfaces": { "subinterface": [ { "index": 0, "config": { "index": 0, "description": "MANAGEMENT INTERFACE - DON'T TOUCH ME", "enabled": true }, "openconfig-if-ip:ipv4": { "addresses": { "address": [ { "ip": "10.10.20.48", "config": { "ip": "10.10.20.48", "prefix-length": 24 } } ] } }, "openconfig-if-ip:ipv6": { "config": { "enabled": false } } } ] }, "openconfig-if-ethernet:ethernet": { "config": { "mac-address": "00:50:56:bf:78:ac", "auto-negotiate": true, "enable-flow-control": true } } }}
Note: The IETF and Native models for IOS XE use separate containers/models for operational data and configuration data, while the OpenConfig combines both config and operational data into the same container. To keep the examples consistent, I have included the "content=config" query parameter in the OpenConfig URL.
curl https://sandbox-iosxe-latest-1.cisco.com/restconf/data/Cisco-IOS-XE-native:native/interface/GigabitEthernet=1 \ -u developer:C1sco12345 \ --header 'Accept: application/yang-data+json'{ "Cisco-IOS-XE-native:GigabitEthernet": { "name": "1", "description": "MANAGEMENT INTERFACE - DON'T TOUCH ME", "ip": { "address": { "primary": { "address": "10.10.20.48", "mask": "255.255.255.0" } } }, "mop": { "enabled": false, "sysid": false }, "Cisco-IOS-XE-ethernet:negotiation": { "auto": true } }}
Choosing which model to use for a project is up to individual developers or teams. However here is some basic advice I give.
You asked if OpenConfig will converge with IETF in the future. With the information above you likely know the answer to this already. They are two different groups, and while there is overlap between what they are working on, there is enough difference that I would expect both to exist for the foreseeable future.
Cisco platforms (IOS XE, IOS XR, NX-OS) will continue to support IETF, OpenConfig and Native models. There are legitimate needs for all three from customers, and we want to enable the choice. The best place to see what models are supported on a platform is up on GitHub at YangModels/yang/vendor/cisco. With each software release, the models supported are published publicly for anyone to find.
Model Driven Programmability topics are some of my favorite to talk about and explore. It is a foundation technology for the automation engineer. This makes it important for us to truly understand and dive into. This makes it ripe for great questions from engineers at all stages of their network automation journey. Do you have a question? Let me know in the comments, or on Twitter (@hfpreston) or via email at [email protected].
And here are some great resources for exploring Model Driven Programmability
We'd love to hear what you think. Ask a question or leave a comment below.
And stay connected with Cisco DevNet on social!
Twitter @CiscoDevNet | Facebook | LinkedIn
Visit the new Developer Video Channel