7/4/25, 8:03 AM Data Models and Structures
Get Unlimited Access to 812 Cisco Lessons Now Sign Up
Search …
Data Models and Structures
Lesson Contents
1. Data Formats
1.1. Extensible Markup Language (XML)
1.2. JavaScript Object Notation (JSON)
1.3. YAML (YAML Ain’t Markup Language)
2. Data Models
2.1. Yet Another Next Generation (YANG)
3. Conclusion
The most common way for the last thirty years to configure our
network devices is the command-line interface (CLI). The CLI is great
for humans, but not so great for computers.
We use configuration commands to configure everything and show or
debug commands to verify our work. The output of show (and debug)
Lessons
commands is formatted, so it’s easy to read for humans. However, it’s a
pain to use the CLI for scripts or network automation tools. You have to
parse a show command to get the information you want, and the
output is different for each show command.
Configuration commands are also an issue. On Cisco IOS, when you
enter a command, there is no confirmation of whether the router or
https://networklessons.com/cisco/ccnp-encor-350-401/data-models-and-structures 1/15
7/4/25, 8:03 AM Data Models and Structures
switch accepts the command or not. You only see the empty prompt. If
Get Unlimited Access to 812 Cisco Lessons Now
you paste a lot of commands, sometimes the console can’t keep up. For
Sign Up
us humans, it’s easy to spot this and work around it. For CLI scripts or
network automation tools, it’s a problem and you have to take this into
account.
An alternative to the CLI to configure network devices is through
application programming interfaces (APIs). APIs use data formats to
exchange information. In this lesson, we’ll discuss the most popular
data formats and structures. We’ll also take a look at YANG data
models.
1. Data Formats
There are two common data formats that APIs often use:
Extensible Markup Language (XML)
JavaScript Object Notation (JSON)
We also call these data formats “data serialization languages”. Another
data format we often use for device configuration is YAML. A good
example for this is Ansible. Let’s talk about these three data formats.
Lessons
01:25
https://networklessons.com/cisco/ccnp-encor-350-401/data-models-and-structures 2/15
7/4/25, 8:03 AM Data Models and Structures
Get Unlimited Access to 812 Cisco Lessons Now Sign Up
1.1. Extensible Markup Language
(XML)
(XML) is a tag-based language and if you know HTML, this will look
familiar.
Each item you add has to start with < and end with >. Here is a simple
example:
<router>
<name>CSR1000V</name>
<vendor>Cisco</vendor>
<type>virtual</type>
</router>
<router>
<name>1921</name>
<vendor>Cisco</vendor>
<type>hardware</type>
</router>
</devices>
The output above shows the tag with two tags in it. The first tag
contains information about a CSR1000V router. The second tag
contains information about a 1921 router.
Let me show you the output of an actual router. Here is the output of
Lessons
show running-configuration as seen from the CLI:
hostname R1
!
ip cef
!
interface GigabitEthernet0/1
https://networklessons.com/cisco/ccnp-encor-350-401/data-models-and-structures 3/15
7/4/25, 8:03 AM Data Models and Structures
ip address 192.168.12.1 255.255.255.0
Get Unlimited Access to 812 Cisco Lessons Now
duplex auto Sign Up
speed auto
media-type rj45
!
interface GigabitEthernet0/2
ip address 192.168.1.254 255.255.255.0
duplex auto
speed auto
media-type rj45
!
end
In XML, it looks like this:
R1#show running-config | format
<?xml version="1.0" encoding="UTF-8"?>
<Device-Configuration
xmlns="urn:cisco:xml-pi">
<version>
<Param>15.6</Param>
</version>
<service>
<timestamps>
<debug>
<datetime>
<msec/>
</datetime>
</debug>
Lessons
</timestamps>
</service>
<service>
<timestamps>
<log>
<datetime>
<msec/>
https://networklessons.com/cisco/ccnp-encor-350-401/data-models-and-structures 4/15
7/4/25, 8:03 AM Data Models and Structures
</datetime>
Get Unlimited Access to 812 Cisco Lessons Now
</log> Sign Up
</timestamps>
</service>
<service operation="delete" >
<password-encryption/>
</service>
<hostname>
<SystemNetworkName>R1</SystemNetworkName>
</hostname>
<ip>
<cef/>
</ip>
<interface>
<Param>GigabitEthernet0/1</Param>
<ConfigIf-Configuration>
<ip>
<address>
<IPAddress>192.168.12.1</IPAddress>
<IPSubnetMask>255.255.255.0</IPSubnetMask>
</address>
</ip>
<duplex>
<auto/>
</duplex>
<speed>
<auto/>
</speed>
<media-type>
<rj45/>
Lessons
</media-type>
</ConfigIf-Configuration>
</interface>
<interface>
<Param>GigabitEthernet0/2</Param>
<ConfigIf-Configuration>
<ip>
https://networklessons.com/cisco/ccnp-encor-350-401/data-models-and-structures 5/15
7/4/25, 8:03 AM Data Models and Structures
<address>
Get Unlimited Access to 812 Cisco Lessons Now
<IPAddress>192.168.1.254</IPAddress> Sign Up
<IPSubnetMask>255.255.255.0</IPSubnetMask>
</address>
</ip>
<duplex>
<auto/>
</duplex>
<speed>
<auto/>
</speed>
<media-type>
<rj45/>
</media-type>
</ConfigIf-Configuration>
</interface>
<end></end>
</Device-Configuration>
One more example. Here is show arp with the CLI output:
R1# show arp
Protocol Address Age (min) Hardware Addr
Type Interface
Internet 192.168.1.1 67 fa16.3ee0.d9a3
ARPA FastEthernet0/0
Internet 192.168.1.2 8 fa16.3ee0.c9b2
ARPA FastEthernet0/0
Internet 192.168.1.3 - fa16.3ee0.a5a5
Lessons
ARPA FastEthernet0/0
And in XML, it looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<ShowArp xmlns="ODM://disk0:/spec.odm//show_arp">
<ARPTable>
https://networklessons.com/cisco/ccnp-encor-350-401/data-models-and-structures 6/15
7/4/25, 8:03 AM Data Models and Structures
<entry>
Get Unlimited Access to 812 Cisco Lessons Now
<Protocol>Internet</Protocol> Sign Up
<Address>192.168.1.1</Address>
<Age>67</Age>
<MAC>fa16.3ee0.d9a3</MAC>
<Type>ARPA</Type>
<Interface>FastEthernet0/0</Interface>
</entry>
<entry>
<Protocol>Internet</Protocol>
<Address>192.168.1.2</Address>
<Age>8 </Age>
<MAC>fa16.3ee0.c9b2</MAC>
<Type>ARPA</Type>
<Interface>FastEthernet0/0</Interface>
</entry>
<entry>
<Protocol>Internet</Protocol>
<Address>192.168.1.3</Address>
<MAC>fa16.3ee0.a5a5</MAC>
<Type>ARPA</Type>
<Interface>FastEthernet0/0</Interface>
</entry>
</ARPTable>
</ShowArp>
These XML outputs are indented which makes them easier to read for
us humans. Indentation however, is not a requirement of XML.
1.2. JavaScript Object Notation (JSON)
Lessons
(JSON) is newer than XML and has a simple syntax. JSON stores
information in key-value pairs and uses objects for its format. It’s
easier to read and has less overhead than XML.
Objects start with { and end with }.
Commas separate objects.
https://networklessons.com/cisco/ccnp-encor-350-401/data-models-and-structures 7/15
7/4/25, 8:03 AM Data Models and Structures
Double quotes wrap names and strings.
Get Unlimited Access to 812 Cisco Lessons Now
Lists start with [ and end with ].
Sign Up
Let’s convert our first XML example into JSON.
XML:
<router>
<name>CSR1000V</name>
<vendor>Cisco</vendor>
<type>virtual</type>
</router>
<router>
<name>1921</name>
<vendor>Cisco</vendor>
<type>hardware</type>
</router>
</devices>
JSON:
"devices": {
"router": [
{
"name": "CSR1000V",
"vendor": "Cisco",
"type": "virtual"
},
{
Lessons
"name": "1921",
"vendor": "Cisco",
"type": "hardware"
}
]
}
}
https://networklessons.com/cisco/ccnp-encor-350-401/data-models-and-structures 8/15
7/4/25, 8:03 AM Data Models and Structures
If you look at the output above, you can see we used the tag twice in
Get Unlimited Access to 812 Cisco Lessons Now
XML. In JSON, we only need a single “router” object. This is a list with
Sign Up
two objects.
1.3. YAML (YAML Ain’t Markup
Language)
According to the official website, YAML is a human friendly data
serialization standard for all programming languages. YAML is a
superset of JSON. This means that a YAML parser understands JSON,
but not necessarily the other way around.
YAML is easier to look at than XML or JSON.
Key-value pairs are separated by : (colon).
Lists begin with a – (hyphen).
Indentation is a requirement. You have to use spaces, you can’t
use tabs.
You can add comments with a #.
We often use YAML files for configuration management because it’s
easy to read and comments are useful.
Let’s compare JSON with YAML. Here’s the JSON object I showed you
before:
JSON:
{
"devices": {
Lessons
"router": [
{
"name": "CSR1000V",
"vendor": "Cisco",
"type": "virtual"
},
{
https://networklessons.com/cisco/ccnp-encor-350-401/data-models-and-structures 9/15
7/4/25, 8:03 AM Data Models and Structures
"name": "1921",
Get Unlimited Access to 812 Cisco Lessons Now
"vendor": "Cisco", Sign Up
"type": "hardware"
}
]
}
}
Here it is in YAML:
devices:
router:
- name: CSR1000V
vendor: Cisco
type: virtual
- name: 1921
vendor: Cisco
type: hardware
YAML is easier to read without the commas and brackets of JSON. One
disadvantage of YAML is that indentation with spaces is a
requirement. It’s easy to make indentation errors where you have a
space too few or too many.
When you work with XML, JSON, or YAML files, you can make
your life much easier if you use an editor that helps with
visualization and indentation. I use Visual Studio Code for
almost everything nowadays.
Lessons
2. Data Models
Data models describe the things you can configure, monitor, and the
actions you can perform on a network device. In this section, we will
discuss YANG.
https://networklessons.com/cisco/ccnp-encor-350-401/data-models-and-structures 10/15
7/4/25, 8:03 AM Data Models and Structures
2.1. Yet Another
Get Unlimited Next
Access to 812 Generation
Cisco Lessons Now Sign Up
(YANG)
SNMP is widely used to monitor networks. You can use SNMP to
configure network devices, but in reality we don’t use it much. CLI
scripting is a more popular option.
01:09
YANG is a modeling language and uses data models that are similar
to to SNMP Management Information Base (MIBs). YANG is a
standard, described in RFC 6020 and increasing in popularity. YANG
uses data models that describe:
What you can configure on a device.
What you can monitor on a device.
Lessons
Administrative actions you can perform on a device like clearing
interface counters or resetting the OSPF process.
YANG Data models can be:
Common data models: industry-wide standard YANG models
from organizations like IETF and IEEE.
https://networklessons.com/cisco/ccnp-encor-350-401/data-models-and-structures 11/15
7/4/25, 8:03 AM Data Models and Structures
Vendor data models: specific models that only apply to products
Get Unlimited Access to 812 Cisco Lessons Now
or features from a vendor.
Sign Up
These data models allow a uniform way for us to configure, monitor,
and interact with network devices. Network automation tools like
NETCONF, RESTCONF, and gRPC require YANG data models. YANG
uses a hierarchical tree structure, similar to the XML data format. There
is a clear distinction between configuration data and state
information.
A YANG module defines a data model through the data of a network
device, and the hierarchical organization and constraints of that data.
YANG identifies each module with a namespace URL.
You can find a collection of YANG modules in the YANG git repository.
In this repository, there are also Cisco modules. For example, take a
look at the modules for IOX XE 16.10.1
There are many module files in the repository. Here is the ARP module
to create a static ARP entry:
Want to Keep Reading? Sign Up Now!
Don't Let Learning Wait - Get Instant Access to 799+ Lessons!
Learn any CCNA, CCNP and CCIE R&S Topic. Explained As Simple
As Possible.
The Best Investment You’ve Ever Spent on Your Cisco Career!
Lessons
Full Access to our 812 Lessons. More Lessons Added Every Week!
Content created by Rene Molenaar (CCIE #41726)
Start Learning Now ►
324 Sign Ups in the last 30 days
https://networklessons.com/cisco/ccnp-encor-350-401/data-models-and-structures 12/15
7/4/25, 8:03 AM Data Models and Structures
100% Satisfaction Guaranteed!
Get Unlimited Access to 812 Cisco Lessons Now
You may cancel your monthly membership at
Sign Up
any time.
No Questions Asked!
« Previous Lesson
Network Automation and
Next Lesson
Device Programmability »
Orchestration
Forum Replies
mustafaa085
Hi There,
Recently, the organization that I’m working for is starting to implement
something called Software Defined Networking, SD-Access. I was wondering
if we have a topic for this technology in this website.
If you have please share it with me. I’m trying to read this topic and get
familiar with it.
Thank you
lagapidis
Lessons
Hello Mustafa
Under the Evolving Technologies section whose link you see below, there is
Unit 2 which is called Network Programmability that deals with SDN. You can
take a look at those lessons which should cover what you need.
https://networklessons.com/cisco/evolving-technologies
https://networklessons.com/cisco/ccnp-encor-350-401/data-models-and-structures 13/15
7/4/25, 8:03 AM Data Models and Structures
SD-Access is something you will also find in the following lesson:
Get Unlimited Access to 812 Cisco Lessons Now Sign Up
https://networklessons.com/cisco/evolving-technologies/cloud-connectivity
Look them over and if you have any more specific questions, just let us know!
I hope this has been helpful!
Laz
mustafaa085
Thank Mr. Lagapides !
This is a great section you showed me sir
lagapidis
Hello Samson
Arista does support Yang models on Github, and you can find those at the
following link:
https://github.com/aristanetworks/yang
For other vendors, you may not find repositories and you may have to create
them yourself. To determine if a particular vendor supports some form of
automation, I suggest you research or contact the specific vendor in
question. They will then lead you to the most appropriate solution.
I hope this has been helpful!
Lessons
Laz
roshanchampika
Hii Laz/Rene,
https://networklessons.com/cisco/ccnp-encor-350-401/data-models-and-structures 14/15
7/4/25, 8:03 AM Data Models and Structures
Is a YANG model = YANG module? what is the difference?
Get Unlimited Access to 812 Cisco Lessons Now Sign Up
11 more replies! Ask a question or join the discussion by visiting
our Community Forum
Disclaimer Privacy Policy Support About
© 2013 - 2025 NetworkLessons.com
Lessons
https://networklessons.com/cisco/ccnp-encor-350-401/data-models-and-structures 15/15