BRKCRS 1452
BRKCRS 1452
BRKCRS 1452
Introduction to Catalyst
Programmability
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 3
Why Programmability?
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 5
Session Focus
IOS XE 16.X enables…
Cisco Solutions 3rd Party Integration DIY Solutions
Cisco DNAC Standards Based Interoperability Custom Development
Model Driven Model Driven
Programmability Telemetry
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 6
IOS XE: Automating Network Device Lifecycle
Goal:
Get devices into an operational state
Provisioning Automation Tools:
Goal:
PXE, ZTP, PnP
Continuously upgrade
network, incrementally Python Scripting
and safely
Tools: Install
Patching
Config/Replace
Goal:
Apply configuration to the
Upgrade Configure device
Goal: Tools:
Add dynamic services, Data Models
optimize behavior and
Optimize Programmable Interfaces
trouble shooting
Python Scripting
Tools:
Operating Data Models
Telemetry
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 7
Device Provisioning
Day 0 Provisioning Automation
updates New
16.5.1 16.5.1
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 9
YANG Data Models
YANG Data Models
CLI YANG Models
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 11
YANG Data Models
Interface Model definition
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 12
Model Driven Programmability
IOS XE Open Interface ”Stack”
Open Native
Intent-based
Network Infrastructure
Configuration and Operation
Device Features
SNMP
Interface BGP QoS ACL …
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 14
Automation: Data is King
Config-data Operational-data
Examples: Examples:
switch> show run interface Loopback0 switch> show interface Loopback0
switch(config)# interface Loopback0 ‘snmpget’ results
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 15
Who Defines YANG Models?
https://github.com/YangModels/yang
https://github.com/openconfig
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 16
IOS XE 16.x YANG Model Support
https://github.com/YangModels/yang/tree/master/vendor/cisco/xe
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public
Encoding Formats
Protocols Data Formats
NETCONF
RESTCONF NETCONF RESTCONF gNMI
gNMI
Data Model
SSH HTTP HTTP/2
Device Features
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 19
XML vs JSON
lightweight, text-based, language-independent data interchange formats
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 20
Protocols:
NETCONF
RESTCONF
gNMI
NETCONF definition
“NETCONF is a protocol defined by the IETF to install, manipulate, and delete the
configuration of network devices”
SSH Transport
2006 2011
https://tools.ietf.org/html/rfc6241
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 22
Main NETCONF Operations
Main Operations Description
<get> Retrieve running configuration and device state information
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 23
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
ssh -p 830 [email protected] -s netconf
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 24
NETCONF Datastores
“A Datastore holds a copy of the configuration data that is required to
get a device from its initial default state into a desired operational state”
Running running-config
Start-up startup-config
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 25
How to use Candidate?
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 26
Enabling NETCONF: 3 Steps
C3850-1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
C3850-1(config)#aaa new-model
C3850-1(config)#aaa authentication login default local Enable AAA
C3850-1(config)#aaa authorization exec default local
C3850-1(config)#username admin password cisco
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 27
REST vs RESTCONF: not the same!
RESTCONF
REST NETCONF RESTCONF gNMI
API PUT
Configuration and Operation
DELETE
Device Features
SNMP
Interface BGP QoS ACL …
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 28
RESTCONF definition
• HTTP[S] transport
https://tools.ietf.org/html/rfc8040
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 29
RESTCONF vs NETCONF Operations
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 30
Enabling RESTCONF
Cat9k-1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 31
gNMI: gRPC Network Management Interface
gNMI
Google
Network Management Interface
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 32
gNMI Operations
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 33
Enabling gNMI: Insecure no-auth mode
Cat9k-1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 34
Enabling gNMI: Secure modes
Cat9k-1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 35
Model Based AAA (ietf-netconf-acm.yang)
Pre IOS XE 16.8.1 IOS XE 16.8.1+
• Clients authenticated locally or via AAA • Clients authenticated locally or via AAA
• Clients authorized via Privilege Level 15 • Clients authorized via Access Control Model
• At any Privilege level
• Matching specific rule sets
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 36
Access Control Model Access Controls
RFC 6536 [ietf-netconf-acm.yang] Client Requests
Controls client requests and event
publications Protocol Data Node
Client YES YES
Operation Access
Access Controls: Request Allowed? Datastore Allowed?
or State
• Protocol operations Data Access
NO NO
• e.g. rpc-name: edit-config
• Module name
• e.g. Cisco-IOS-XE-native Events
• Data node
• e.g. path: /native/hostname Event
Notification YES
Allowed?
• Notifications
• e.g. name: ConfigChange NO
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 37
YANG Tools:
Pyang
YangExplorer
YDK
YANGSuite
Pyang Tool
“Tool to validate and navigate YANG Models”
schema tree YANG Model depth option
https://github.com/mbj4668/pyang
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 39
YangExplorer
“A GUI driven tool to test NETCONF and RESTCONF
interfaces defined by YANG models”
https://github.com/CiscoDevNet/yang-explorer
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 40
YDK: YANG Development Kit
Wide support of Yang Models Support for NETCONF Support for Python
Open or Native and RESTCONF And C++ APIs
https://developer.cisco.com/site/ydk/
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 41
Demo
YANGSuite
Demoed
@ WoS
Telemetry
gRPC
gNMI
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 44
Legacy Data Transfer Mechanisms Insufficient for
Programmatic Environments
SNMP
syslog
CLI
• Interface up/down
• Instantaneous config Storage and
• Instantaneous topology Analytics
• Flow fingerprints
• Routes
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 45
Why Model Driven Telemetry is Important
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 46
Model Driven Telemetry
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 47
Model Driven Telemetry
• Periodic or On-change
Device Features
SNMP
Interface BGP QoS ACL …
* future
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 48
Publication and Subscriptions
Dial-in vs Dial-out
S S
Dial-in Dial-out
Dynamic Configured
P P
Device Features
SNMP
Interface BGP QoS ACL …
* future
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 49
Periodic subscription
t t t t t t t
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 50
gRPC Dial-Out CLI config example
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 51
On-change subscription
t t t t t t t
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 52
Use Case: Monitoring
Demo
IOS XE Device
gRPC Dial-Out
Collector
Time Series DB
Monitoring
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 53
Python on IOS XE
Using Python with IOS XE Devices
“Off-Box” Python IOS XE “On-Box” Python IOS XE
16.5.1
Linux Server
Python
SSH/NETCONF
Python
IOS-XE Device
IOS
IOS IOS-XE Device
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 56
Guest Shell
Virtualized Linux Environment On Your Switch
• Application Hosting
Guest Shell
• Disabled by default Linux Container
API
switch# guestshell enable
Network OS
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 57
Guest Shell (On-Box Python)
Fault/resource
isolation
Guest Shell
(CentOS 7) Local telemetry
Intent-based
processing
Network Infrastructure
YANG / CLI / EEM
APIs Python
interpreter
Cisco IOS XE
Linux workflow
integration
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 58
Auto Back-up Use Case
“On-Box” Python and EEM
1
2 User configures the device
Python script saved on the device
EEM
WebEx
2 1
Python script saved on the device User made changes on the device
EEM
Catalyst 9000
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 62
Application Hosting in the Enterprise
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 63
IOS XE Application Hosting
VM VM VM LXC LXC
IOS XE
Custom
App
IOS XE Kernel
Kernel
IOx App
storage
console
certificates
https://developer.cisco.com/site/iox/
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 65
Virtual Machine Workflow
VM Convert Image
qemu-img convert -O qcow2
centos7.vmdk centos7.qcow2
https://github.com/CiscoDevNet/centos-vm-on-ios-xe
© 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public
Docker Workflow BRKCRS 2004
Dockerfile Build Docker Image
docker build -t perfsonar .
1 2
4
Deploy App DNA-C
3 Docker VM
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 67
Coming
Soon
16.10
REST
REST
YANG
CLI WebUI
Models
REST
Custom
App
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 68
Cat9K HW Resources
Memory CPU Storage
Platform (GB) (GB)
Cores vCPU
Catalyst 9300 2 1 2 120
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 69
Catalyst 9K – SSD Storage
Cat 9300/9500 Cat 9400 Cat 9500
high-performance
Plug into
Back Panel Back Panel
removable SUP
LXC demo
Iperf3
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 71
Configuration
Management Tools
Configuration Management Tools
Desired State
(Intent)
configuration
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 74
Architecture: agent vs agent-less
TODAY
CLI
Intent NETCONF
gNMI
Puppet
config CLI
NETCONF RESTconf
Agent Parser
Data Model
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 75
Ansible Strengths
• Agentless
• Written in Python
• Open Source
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 76
Ansible release 2.5 & 2.7
Cisco IOS/IOS-XE Core Modules
• ios_banner Manage multiline banners
• ios_command Run commands on remote devices
• ios_config Manage Cisco IOS configuration
• ios_facts Collect facts from remote devices
• ios_interface Manage Interface
• ios_logging Manage logging
• ios_ping Tests reachability
• ios_static_route Manage static IP routes
• ios_system Manage System attributes
• ios_user Manage of local users
• ios_vrf Manage VRF definitions
• ios_l2_interface Manage Layer-2 interface
• ios_l3_interface Manage L3 interface
• ios_linkagg Manage port channels
• ios_lldp Manage LLDP config
• ios_vlan Manage VLANs
• netconf_config Supports NETCONF connection
https://docs.ansible.com/ansible/list_of_network_modules.html#ios
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 77
Ansible Taxonomy
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 78
Architecture: agent-less + APIs Soon…
All Platforms
Device Features
* not committed by ISV (independent software vendor) © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public
Configuration Management Templates
Cisco Validated Design
https://github.com/CiscoDevNet/cvd-config-templates
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 80
Cisco DevNet
Cisco DevNet
• Learning Labs
• Sandboxes
• API Documentation
• Python, YDK, REST
• And More!
https://developer.cisco.com/
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 82
IOS XE on DevNet
https://developer.cisco.com/site/ios-xe/
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 83
DevNet Cat9K Sandbox
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 84
Conclusion
IOS XE Programmability Journey
Shipping! Shipping! Shipping! Shipping!
Shipping!
May 2017 August 2017 April 2018 July 2018 November 2018 Roadmap
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 86
IOS XE Programmability Sessions @ CL Barcelona
Breakout Sessions:
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 87
Cisco Webex Teams
Questions?
Use Cisco Webex Teams (formerly Cisco Spark)
to chat with the speaker after the session
How
1 Find this session in the Cisco Events Mobile App
2 Click “Join the Discussion”
3 Install Webex Teams or go directly to the team space
4 Enter messages/questions in the team space
cs.co/ciscolivebot#BRKCRS-1450
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 88
Complete your online
session survey
• Please complete your Online Session
Survey after each session
• Complete 4 Session Surveys & the Overall
Conference Survey (available from
Thursday) to receive your Cisco Live T-
shirt
• All surveys can be completed via the Cisco
Events Mobile App or the Communication
Stations
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 89
Continue Your Education
BRCKRS-1450 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 90
Thank you