Watch the replay: http://cs.co/90028vTty
You have heard of NETCONF, YANG, Python, and REST. However, do you really understand what they can do for your business, network, and networking career?
Learn how you can create apps that automate operations, consume network telemetry, and control network resources with minimal programming experience.
Resources:
Watch the New Era of Networking playlist: http://cs.co/90058sI1U
1. Beyond Command Line Interface:
Catalyst Switching Programmability
Jeff McLaughlin, Fabrizio Maccioni
August9, 2017
2.
3. IOS XE 16.x: Industry-Leading Open
Programmable OS
Easy onboarding of
devices using turnkey and
open source tools
Consistent management
of devices through
machine interfaces
Develop, deploy, test new
services on devices
Stream granular data for
real time monitoring and
troubleshooting
Open Standards Based Extensible Consistent
API
Device
Onboarding
Configuration
Automation
Application
Hosting
Telemetry
4. IOS XE: Automating Network Device Lifecycle
Install
Configure
Optimize
Upgrade
Goal:
Apply configuration to the
device
Tools:
Data Models
Programmable Interfaces
Python Scripting
Goal:
Continuously upgrade
network, incrementally
and safely
Tools:
Patching
Config/Replace
Goal:
Get devices into an operational state
Provisioning Automation Tools:
PXE, ZTP, PnP
Python Scripting
Goal:
Add dynamic services,
optimize behavior and
trouble shooting
Tools:
Operating Data Models
Telemetry
7. Device Provisioning Automation
Pre-boot Execution
Environment (PXE) Client
Zero Touch
Provisioning
Cisco Network Plug
and Play
Boot Image
Source
Network Device Device
Programmable
Interfaces
Open Open Open (via APIC-EM)
Ideal for heterogeneous /
multi-vendor network environments
Optimized for Cisco networks
(highly secure and scalable)
updates
16.5.1
New
16.5.1
Boot Server
PXE Booting
Switch
ZTP Server
ZTP Agent
SwitchZTP script
PnP Agent
SwitchPnP Agent
8. Config Templates Use Case
PnP Templates
hostname $hostname
enable password xxx
!
username sdn password 0 xxx
!
ip http server
ip http secure-server
snmp-server community xxxx RO
!
line con 0
line vty 0 15
login local
transport input ssh telnet
end
variables prefixed by $
Template GUI form:
https://communities.cisco.com/community/developer/dna/blog/2016/10/30/apic-em-13-update-plug-and-play-network-automation-api-part1
New
APIC-EM 1.3
Launch APIC-EM
13. YANG Data Models
YANG
Model
container ip {
list vrf {
leaf rd
}
}
Data
red_vrf
rd 65001:1 XML
<vrf>red</vrf>
<rd>1:1</rd>
YANG models can be used as a template for generating structured
data in many different formats.
JSON
{“vrf”: “red”
“rd”: “1:1”}
14. YANGcontainer ip {
list vrf {
description
"Configure an IP VPN Routing/Forwarding
instance";
leaf name {
type string;
}
leaf rd {
description
"Specify Route Distinguisher";
type rd-type;
}
}
}
XML<ip>
<vrf>
<name>vrf_red</name>
<rd>65000:1</rd>
</vrf>
<vrf>
<name>vrf_green</name>
<rd>65000:2</rd>
</vrf>
</ip>
YANG Configuration Model Example*
* Note: YANG model simplified for clarity
ip vrf vrf_red
rd 65001:1
!
ip vrf vrf_green
rd 65001:2
!
CLI
15. Who Defines YANG Models?
https://github.com/YangModels/yang
https://github.com/openconfig
16. NETCONF Highlights
• Transactional
• Either all configuration is applied or nothing
• Avoids inconsistent state
• Both at Single Device and Network-wide level
• Error Management
• OK or error code
• Capability Exchange
• Models Download from a Device
ssh -p 830 admin@172.26.249.169 -s netconf
19. PYANG Tool
“Tool to validate and navigate YANG Models”
pyang -f tree ietf-interfaces@2014-05-08.yang --tree-depth 4
depth optionschema tree YANG Model
https://github.com/mbj4668/pyang
22. Streaming Telemetry
Export enriched, consistent and concise data with context from
network devices for a better user and operator experience
Periodic or
On-Change
Structured Data Scalable Reduced CPU
Load
24. Streaming Telemetry
NETCONF RESTCONF gRPC
Device Features
Interface BGP QoS ACL …
SNMP
YANG Data Model
Open Native Open Native
Physical and Virtual Network Infrastructure
Configuration Operational
Programmable
Interfaces
Collector
Subscription
Periodic or on-change
tcollector
28. Python: Why not C, Ruby, Perl, TCL, Go,
etc.?
Easy to Learn
Interactive shell
Easy to begin with simple scripts
Libraries!
Extensive libraries, like an “app store” for developers
Read Excel, output PDF, draw graphs, etc.
And it’s well supported in the networking community!
31. Python 2 vs 3
Python 2.7.10
>>> print "Hello World!”
Hello World!
Python 3.6.0a4
>>> print "Hello World!"
SyntaxError: Missing parentheses
>>> print ("Hello World")
Hello World
Python 2
• Most common version
• Default installation on Linux
• Most libraries
• Losing popularity
Python 3
• Several language enhancements
• Often separate installation
• Not all libraries supported
• Commonly used in books/courses
Python 2 and 3 are not mutually compatible!
35. Installing git
Install Git using the standard installers on Mac/Windows
Use the usual methods on Linux (apt-get, yum, rpm, etc.)
Highly Recommended: Install GitHub Desktop!
37. Using Python with IOS XE Devices
scripts executed externally from switch:
• configuration management automation
• telemetry / operational data
• controller use cases including APIC-EM /
Cisco Network PNP
IOS-XE DeviceIOS
Python
SSH/NETCONF
“Off-Box” Python
Linux Server
• scripts executed locally on switch:
• provisioning automation (ZTP)
• automating Embedded Event Manager
• application development
• IOT
IOS-XE Device
IOS
Python
IOS XE “On-Box” Python
IOS XE
16.5.1
38. Guest Shell
Virtualized Linux Environment On Your Switch
• Secure Linux shell environment
• On-box rapid prototyping
• Application Hosting
• Disabled by default
switch# guestshell enable
Network OS
Guest Shell
Linux Container
API
Linux
applications
IOS XE
16.5.1
46. IOx Client Fog Director
Local Manager
REST
REST
REST
Cisco Application Framework (CAF)/IOx
Host OS (IOS XE Kernel)
Linux Process Linux Process
Kernel
LXC VM
CLI
External Management Tools
On-Box Management Tools
50. "If a thing is worth doing, it is worth doing badly."
- G.K. Chesterton
51. How do I learn Python?
Automate the Boring Stuff with Python,Al Sweigart
Great introduction to Python focusedon automation. (Not
specifically network automation.) Covers Python 3.0 only.
Assumes zero knowledge. Read Excel docs, generate PDFs,
etc. Highly recommended.
Real Python. http://realpython.com
Three-part course. Begins with basics assuming no
knowledge. Covers Python 2.7 and 3.0. Parts II and III focus
on web development with Python. Covers flask, Django, jinja2
templates. Many resources on the web site for free.