Professional Documents
Culture Documents
How
1. Find this session in the Cisco Live Mobile App
2. Click “Join the Discussion”
3. Install Spark or go directly to the space
4. Enter messages/questions in the space
cs.co/ciscolivebot#BRKSDN-2666
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Agenda
• Introduction
• Why Programmability?
• IOS XE Evolution
• Database Architecture
• Data Models
• Application Hosting
• Conclusion
Computing in the 1990s...
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 5
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 6
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 7
Configuring a BGP neighbor then...
router# config t
router(config)# router bgp 100
router(config-bgp)# neighbor 1.1.1.1 remote-as 100
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 8
Configuring a BGP neighbor now...
router# config t
router(config)# router bgp 100
router(config-bgp)# neighbor 1.1.1.1 remote-as 100
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 9
Has anything really changed?
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 10
OS 6.0 released IOS XE 3.x Polaris
"Top Gun" released BinOS IOS XE 16.x
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 11
Why programmability?
Why automation and programmability?
hostname switch1
int g0/0
ip address 10.1.1.11/24
vlan 100,200,300
.
Needs to configure
Administrator
.
.
hostname switch6
int g0/0
ip address 10.1.1.16/24
vlan 100,200,300
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 13
Notepad is the most common automation tool. It’s just a very bad automation tool.
...
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 14
52037606 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
* pseudo-code
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 15
party apps
Cisco ISE
Catalyst switches
DNA Center
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 16
Transactionality
int g0/0
ip address 10.1.1.0/24
no shutdown
router bgp 65001
router-id 172.17.1.99
bgp log-neighbor-changes
neighbor 192.168.1.2 remote-as 40000
neighbor 192.168.3.2 remote-as 50000
address-family ipv4 unicast
neighbor 192.168.1.2 activate
network 172.17.1.0 mask 255.255.255.0
exit-address-family
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 17
Operational Simplification
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 18
Operational Simplification
# ping 172.16.100.101
# show arp | i 172.16.100.101
# show mac address-table address 001a.a24d.5141
# show cdp neighbor g0/1 detail
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 19
Operational Simplification
# show mac address-table address 001a.a24d.5141
# show cdp neighbor g0/10 detail
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 20
Operational Simplification
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 21
Operational Simplification
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 22
IOS XE Evolution
Classic IOS Challenges
Monolithic
Process not independent of one another
Common Memory
Config/oper data centralized, not easily shared
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 24
Classic vs. IOS XE Architecture
Classic IOS IOS XE 16.x
Hosted Apps
IOSd
Feature Components IOSd IOSd
IOS Sub- LXC LXC VM
Systems
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 25
IOS XE: Linux-based OS
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 26
IOS XE: Capability for restartable Processes
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 27
IOS XE: Database Architecture
enumeration literals
LINE_UP
LINE_DOWN
LINE_ADMIN_DOWN
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 28
Structured Data
Structured vs Unstructured Data
Un-structured
Structured
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 30
Hierarchical Structured Data (XML-like)
<user1>
First User
{ <name>John Smith</name>
<age>42</age>
<phone>+1-415-555-1212</phone>
</user1>
<user2>
Second User
{ <name>Sarah Kim</name>
<age>27</age>
<phone>+1-718-555-1212</phone>
</user2>
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 31
Ancient unstructured data
COULDYOUREADITIFWEWROTELIKETHIS
WITHNOPUNCTUATIONITISHARDTOFIGUR
EOUTWHEREONEWORDORSENTENCEBE
GINSORENDSANDITISNOTEASYTOSEPAR
ATEOUTALLTHEELEMENTSOFTHETEXTTH
ANKGOODNESSSOMEONECAMEUPWITHA
BETTERWAY
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 32
Note inconsistent “key” format!
switch1# sh int e1/10
Ethernet1/10 is up
Hardware: 1000/10000 Ethernet, address: 0005.73d0.9331 (bia 0005.73d0.9331)
Description: To UCS-11
MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec,
reliability 255/255, txload 1/255, rxload 1/255
Switchport monitor is off
EtherType is 0x8100
Last link flapped 8week(s) 2day(s)
Last clearing of "show interface" counters 1d02h
30 seconds input rate 944 bits/sec, 118 bytes/sec, 0 packets/sec
30 seconds output rate 3110376 bits/sec, 388797 bytes/sec, 5221 packets/sec
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 33
Configuration vs. Operational data
Configuration data tells the device what to do. It is Operational data tells us how a device is operating,
data that you see in a “show run”. from show commands other than “show run”.
We can write configuration data (think “conf t”), Operational data is read-only.
and we can read configuration data (think “show
run”).
Configuration Data
IP Address: 172.26.244.110
Remote ASN: 65010
Description: Lab Internal BGP peer
MD5 password: cisco123
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 36
What data does IOS XE need to store?
BGP
Operational Data
State: ACTIVE
Peer uptime: 2d10h32m
Messages Sent/Received: 14533/15830
Routes Sent/Received: 252/174
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 37
BGP Code
IOS Memory
/* BGP neighbor structure. */ Interfaces AAA
typedef struct peer
{
STP EEM SSH
char *desc; /* Description of the peer. */
unsigned short port; /* Destination port for peer */
char *host; /* Printable address of the peer.*/ BGP Unused IPSec
time_t uptime; /* Last Up/Down time */
time_t readtime; /* Last read time */ STP QoS ACLs
time_t resettime; /* Last reset time */
...etc... SLA OSPF WCCP
}
Note: Memory for a process is probably not going to be contiguous! Simplified for slide.
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 38
Database Architecture Goals
Database
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 39
Database Architecture Goals
Database
BGP Code
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 40
Database Architecture Goals
Database
BGP Code
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 41
Database Architecture Goals
Database
BGP Code
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 42
Database Architecture Goals
Database
OSPF Code
BGP Code
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 43
Database Architecture Goals
DB
Simplified View
NETCONF
RESTCONF
gNMI/gRPC
gNMI
NETCONF RESTCONF
gRPC
Protocols
CLI
Parser
Data Model YANG Models
Device Features
Device
Interface BGP QoS ACL … Features
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 46
XML vs JSON
{
<interfaces xmlns:=“[…]yang:ietf-interfaces”> "ietf-interfaces:interfaces": {
<interface> "interface": [
{
<name>eth0</name> "name": "eth0”,
<type>ethernetCsmacd</type> "type": "ethernetCsmacd”,
<location>0</location> "location": "0”,
<enabled>true</enabled> "enabled": true,
<if-index>2</if-index> "if-index": 2
}
</interface> ]
</interfaces> }
}
NETCONF NETCONF/RESTCONF
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 47
Error!
<interface>Gigabit 1/0</interface>
<ifaddr>10.0.0.1/24</ifaddr>
Sends
Expecting
Expecting:
<interface>
<name>Gigabit 1/0</name>
<address>10.0.0.1/24</address>
</interface>
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 48
So why do we need YANG?
<interface>Ethernet 0/0</interface>
<name>Switch1 to UCS1</name>
<ipaddr>1.1.1.1/24</ipaddr>
<ifname>Ethernet 0/0</ifname>
<ifalias>Switch1 to UCS1</ifalias>
<ifaddr>1.1.1.1/24</ifaddr>
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 49
YANG Data Models
container ip {
list vrf { vrf red
rd 1:1 <vrf>red</vrf>
leaf rd
<rd>1:1</rd>
}
}
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 50
YANG Data Models
<vrf>red</vrf>
<rd>1:1</rd>
container ip {
list vrf { vrf red
leaf rd rd 1:1 XML
}
}
{“vrf”: “red”
YANG Data “rd”: “1:1”}
Model
JSON
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 51
YANG Configuration Model Example*
container ip { YANG <ip> XML
list vrf { <vrf>
description <name>vrf_red</name>
"Configure an IP VPN Routing/Forwarding <rd>65000:1</rd>
instance"; </vrf>
<vrf>
leaf name { <name>vrf_green</name>
type string; <rd>65000:2</rd>
} </vrf>
</ip>
leaf rd {
description ip vrf vrf_red CLI
"Specify Route Distinguisher"; rd 65001:1
type rd-type; !
} ip vrf vrf_green
} rd 65001:2
} !
* Note: YANG model simplified for clarity BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 52
So why is this:
<ip>
<vrf> ...better than this?
<name>vrf_red</name> ip vrf vrf_red
<rd>65000:1</rd> rd 65001:1
</vrf> !
<vrf> ip vrf vrf_green
<name>vrf_green</name> rd 65001:2
<rd>65000:2</rd> !
</vrf>
</ip>
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 53
CLI
ip vrf vrf_red
rd 65001:1
!
ip vrf vrf_green
rd 65001:2
!
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 54
YANG-structured data
<ip>
<vrf>
<name>vrf_red</name>
<rd>65000:1</rd>
</vrf>
<vrf>
<name>vrf_green</name>
<rd>65000:2</rd>
</vrf>
</ip>
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 55
Where are YANG models?
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 56
Where are YANG models?
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 57
Where are YANG models?
https://github.com/YangModels/yang/tree/master/vendor/cisco
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 58
Who defines the YANG models?
Vendors Standards Bodies
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 59
Important Point!
Cisco’s data models and IETF/OpenConfig data models are just two ways of doing the same thing.
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 60
Important Point!
Cisco’s data models and IETF/OpenConfig data models are just two ways of doing the same thing.
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 61
Finding and using YANG models
YangExplorer: A Cisco tool for exploring models
Available at:
https://github.com/CiscoDevNet/yang
-explorer
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 63
YangExplorer: A Cisco tool for exploring models
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 64
YangExplorer: A Cisco tool for exploring models
Models on device
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 65
YangExplorer: A Cisco tool for exploring models
Models on device
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 66
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 67
Finding a model, method 1
Click “RPC”.
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 68
Finding a model, method 1
Click “RPC”.
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 69
Finding a model, method 1
Click “RPC”.
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 70
Model-Driven Telemetry
Real World Telemetry
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 72
Where Data Is Created Where Data Is Useful
SNMP
syslog
Applications
CLI
• Interface up/down Network
• Instantaneous config NMS Controller Element
• Instantaneous topology
• Flow fingerprints
• Routes
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 73
SNMP Polling
SNMP Get
SNMP Response
...wait 5 mins...
SNMP Get
SNMP Response
...wait 5 mins...
SNMP Get
SNMP Response
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 74
NETCONF-based Telemetry (Periodic)
NETCONF Session
YANG Push
...wait 5 secs...
...wait 5 secs...
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 75
Periodic subscription
t t t t t t t
Counters / Measures
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 76
NETCONF-based Telemetry (On-Change)
NETCONF Session
Model Subscription
(Event)
On Change Push
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 77
On-change subscription
t t t t t t t
IOx Orchestration
LXC LXC VM
Multiple apps
App 1 App 2 App 3
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 81
External Management Tools
REST
REST
CLI Local Manager
REST
LXC VM
Kernel
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 82
More t o Enhancing Fabric
come functionality through
Hosted Apps
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 83
On-Box Python
On-box Python Scripting
CLI
NETCONF
Syslog
Guestshell
Container
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 85
Advantages
On-Box
• Access CLI directly on device
• Trigger syslog messages
• Interact with Embedded Event Manager
• Access device bootflash
• Power-On Auto-Provisioning (ZTP)
• Use interactive Python shell
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 86
Enabling on-box Python
jemclaug-hh15-c3850-2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
IOX is the container manager,
jemclaug-hh15-c3850-(config)#iox
similar to Docker.
jemclaug-hh15-c3850-(config)#^Z
jemclaug-hh15-c3850-2#guestshell ?
destroy Disable and uninstall the guest shell service package
disable Disable the guest shell service package
enable Enable the guest shell service
run Execute/run program in the guest shell
<cr>
jemclaug-hh15-c3850-2#guestshell enable
The process for the command is not responding or is otherwise Wait for IOX to enable
unavailable
jemclaug-hh15-c3850-2#guestshell enable
Guestshell enabled successfully with tracefile support Success! Python read for use.
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 87
On-box CLI APIs
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 88
On-box CLI APIs
>>>
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 89
Catalyst 3850
EEM
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 90
Catalyst 3850
EEM
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 91
Catalyst 3850
EEM
2 Change detected by EEM
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 92
Catalyst 3850
EEM
3 EEM Triggers on-box Python script BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 93
4 Python script diffs configs and sends diff to Spark
Catalyst 3850
EEM
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 94
3 Spark posts diff to room
Catalyst 3850
EEM
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 95
In Closing
Thanks to engineers who helped!
Everything good came from them, any faults or errors are my own.
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 97
How do I learn Python?
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 98
Cisco DevNet
• Learning Labs
• Sandboxes
• API Documentation
• Python, YDK, REST
• And More!
http://developer.cisco.com
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 99
• Identify one problem you can solve with a script
• Start small
• Copy and modify scripts from DevNet
• (developer.cisco.com)
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 100
Cisco Spark
Questions?
Use Cisco Spark to communicate
with the speaker after the session
How
1. Find this session in the Cisco Live Mobile App
2. Click “Join the Discussion”
3. Install Spark or go directly to the space
4. Enter messages/questions in the space
cs.co/ciscolivebot#BRKSDN-2666
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
• Please complete your Online Complete Your Online
Session Evaluations after each
session
Session Evaluation
• Complete 4 Session Evaluations
& the Overall Conference
Evaluation (available from
Thursday) to receive your Cisco
Live T-shirt
• All surveys can be completed via
the Cisco Live Mobile App or the
Communication Stations
Don’t forget: Cisco Live sessions will be available
for viewing on-demand after the event at
www.ciscolive.com/global/on-demand-library/.
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Continue Your Education
• Demos in the Cisco campus
• Walk-in Self-Paced Labs
• Tech Circle
• Meet the Engineer 1:1 meetings
• Related sessions
BRKSDN-2666 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 103
Thank you