BRKDCN 2025
BRKDCN 2025
Maximizing Network
Programmability and
Automation with
Open NX-OS
Nicolas Delecroix, Technical Marketing
Engineer, INSBU
ndelecro@cisco.com
BRKDCN-2025
#CLUS
Open NX-OS
• Open NX-OS represents the
programmability feature set of
NX-OS running on Nexus 9K.
• Every feature discussed in this
presentation is supported on every
Nexus 9K model.
• Some features are also supported on
Nexus 3K/5K/7K. This is summarized
at the end of the presentation.
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 3
Objectives
• Share with you the latest Open NX-OS programmability innovations.
• Share demos based on real-world use cases. We’ll use VXLAN
BGP EVPN as a common theme.
• Provide you with ways to get started in minutes.
#CLUS © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Agenda
• Extending NX-OS
• Guest Shell
• NX-SDK
• Automating NX-OS
• NX-API
• Ansible
• NETCONF and YANG
• YDK
• Monitoring NX-OS
• Streaming Telemetry
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 5
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 Live 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
#CLUS © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 6
Extending NX-OS
Guest Shell
Securely Run Custom On-Box Linux Apps
$ dohost
NX-OS Guest Shell: Secure Linux Container 64
JSON Bit
CLI
Open-Source Your Custom Apps
bootflash: Apps (C, Python, Go…)
Network
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
All Nexus 9K Front Panel Interfaces Exist as Linux
Network Devices
[root@guestshell ~]# ifconfig Eth1-42
Eth1-42: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 13.0.0.42 netmask 255.255.255.0 broadcast 13.0.0.255
ether 54:7f:ee:8e:27:bc txqueuelen 100 (Ethernet)
RX packets 3790 bytes 258373 (252.3 KiB)
RX errors 0 dropped 3553 overruns 0 frame 0
TX packets 772 bytes 201535 (196.8 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 12
Guest Shell Export on the Development Switch
dev-switch# guestshell
[guestshell@guestshell ~]$ ls –l
total 6
-rw-rw-r-- 1 guestshell users 303 Apr 12 2018 buffer_monitoring.py
-rw-rw-r-- 1 guestshell users 946 Apr 12 2018 ptp_monitoring.py
[guestshell@guestshell ~]$ exit
logout
dev-switch#
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 13
Guest Shell Export on the Development Switch
dev-switch# guestshell
[guestshell@guestshell ~]$ ls –l
total 6
-rw-rw-r-- 1 guestshell users 303 Apr 12 2018 buffer_monitoring.py
-rw-rw-r-- 1 guestshell users 946 Apr 12 2018 ptp_monitoring.py
[guestshell@guestshell ~]$ exit
logout
dev-switch#
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 14
Guest Shell Export on the Development Switch
dev-switch# guestshell
[guestshell@guestshell ~]$ ls –l
total 6
-rw-rw-r-- 1 guestshell users 303 Apr 12 2018 buffer_monitoring.py
-rw-rw-r-- 1 guestshell users 946 Apr 12 2018 ptp_monitoring.py
[guestshell@guestshell ~]$ exit
logout
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 15
Guest Shell Import on the Production Switches
prod-switch# copy scp://dev-switch/my_guest_shell bootflash: vrf management
my_guest_shell 100% 250MB 12.5MB/s 00:20
Copy complete.
prod-switch#
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 16
Guest Shell Import on the Production Switches
prod-switch# copy scp://dev-switch/my_guest_shell bootflash: vrf management
my_guest_shell 100% 250MB 12.5MB/s 00:20
Copy complete.
prod-switch# guestshell
[guestshell@guestshell ~]$ ls –l
total 6
-rw-rw-r-- 1 guestshell users 303 Apr 12 2018 buffer.py
-rw-rw-r-- 1 guestshell users 946 Apr 12 2018 ptp_monitoring.py
[guestshell@guestshell ~]$
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 17
Agenda
• Extending NX-OS
• Guest Shell
• NX-SDK
• Automating NX-OS
• NX-API
• Ansible
• NETCONF and YANG
• YDK
• Monitoring NX-OS
• Streaming Telemetry
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 18
NX-SDK
Tighter Integration of Custom Linux Apps
with NX-OS
• NX-SDK: a simple, flexible and powerful set of APIs for
custom on-box applications to gain access to NX-OS infra
functionalities.
• Apps are still traditional Linux programs, they just use the NX-SDK
APIs and register with NX-OS.
• Apps run natively just like any other native NX-OS feature.
• Startup and management is handled by NX-OS, similar to the native
NX-OS features.
#CLUS © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
NX-SDK Features
• NX-OS 7.0(3)I6(1) – May • NX-OS 7.0(3)I7(3) – February
2017: 2018:
• Python and C++ support. • RIB APIs:
• Definition of custom CLIs: • Route lookup.
• Config and show commands. • Route events. Get notified upon
updates: route add, route remove,
• Callback handler with your code gets
next-hop change.
invoked when the CLI gets
executed. • Granularity for lookup and events
can be prefix, protocol, address
• Generation of custom syslogs. family, VRF.
• Streaming Telemetry support.
#CLUS © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Nexus 9K
Linux
NX-SDK API Library
NX-OS
Much More…
Syslog, Event & Event
CLI Error history
HA Manager
DME, RIB, timers,
etc.
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 22
Any Linux NX-SDK Toolkit
Server Use the toolkit to write the app
Custom Application and package it offline
Code
Copy the app to the switch, and start it like a regular NX-OS feature
Nexus 9K
Linux
NX-SDK API Library
NX-OS
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 24
Code: https://github.com/CiscoDevNet/NX-SDK/tree/master/examples
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 25
CLI and Syslog APIs
• Gain access to NX-OS CLI
cli = sdk.getCliParser()
• Create a new custom CLI config command
cli.newConfigCmd(“threshold_cmd”,
“threshold <value>”)
cli.updateParam("<value>",
”Threshold value in Mbps",
nx_sdk_py.P_INTEGER)
• Add our command handler callback for custom CLI
myCmd = pyCmdHandler()
cliP.setCmdHandler(myCmd)
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 26
RIB APIs
• Gain access to NX-OS RIB
ribMgr = sdk.getRibMgr()
• Register for RIB callback handler, that will be invoked when a route event
happens
myRibCb = pyRibHandler()
ribMgr.setRibMgrHandler(myRibCb)
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 27
Demo: ECMP Load Monitoring with NX-SDK
1. The user configures the link threshold via a custom CLI
10G link 2. Our app automatically detect ECMP bundles
3. If the bandwidth usage of a ECMP link member exceeds
4G flow the threshold, then display a custom NX-OS syslog
ECMP Bundle
#CLUS © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
NX-SDK Visibility and Control
• Today NX-SDK is only available from the native Bash shell.
• See the memory footprint of all NX-SDK objects:
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 30
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 31
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 32
Agenda
• Extending NX-OS
• Guest Shell
• NX-SDK
• Automating NX-OS
• NX-API
• Ansible
• NETCONF and YANG
• YDK
• Monitoring NX-OS
• Streaming Telemetry
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 33
Automating NX-OS
Telnet NX-API NETCONF RESTCONF gRPC
NETCONF NX-API SNMP
or REST Client Client Client
Client Client Client
SSH Client (YANG) (YANG) (YANG)
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
NX-API
Automation via Telnet/SSH can be Challenging
#CLUS © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
{
"jsonrpc": "2.0",
"method": "cli",
CLI "params": {
"cmd": "show version",
Request "version": 1
Management },
Server }
"id": 1
{
"jsonrpc": "2.0",
"result": {
"body": {
"bios_cmpl_time": "03/02/2017",
JSON "bootflash_size": 7906304,
"kickstart_ver_str": "7.0(3)I7(3)",
Response "chassis_id": "Nexus 9508",
... Nexus 9K
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 38
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 39
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 40
NX-API Customer Use Case
• Top-3 hosting provider in Europe. • The placement of customers’
Infrastructure based on VXLAN. workload can be under any VTEP.
• Every tenant is able to use the • When a tenant is given new
whole 4K VLAN range for his/her servers for the first time, a robot
workloads. Packets egressing from uses NX-API to configure the
the server are already tagged with VTEPs:
a VLAN. Q-in-VNI is used to • Create a tenant-specific VRF and IP
preserve the customer VLAN. gateway for internet access.
• The network is fully automated • Create a tenant-specific L2VNI.
with NX-API. No manual CLI • Assign the L2VNI for every access
anymore, except for port under which the tenant
troubleshooting. workloads reside.
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 41
https://github.com/ndelecro/Nexus-9K-Programmability/tree/master/NX-API_CLI
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 42
Get Started With Just Two Commands
Ready-to-use Docker container with pre-build environment and NX-API apps
ready to run:
[user@server ~]# docker run -it ndelecro/nexus9k-programmability:latest
Status: Downloaded newer image for docker.io/ndelecro/nexus9k-programmability:latest
root@a3d1f69d8067:~#
#CLUS © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
[user@server ~]# docker run -it ndelecro/nexus9k-programmability:latest
Status: Downloaded newer image for docker.io/ndelecro/nexus9k-programmability:latest
root@a3d1f69d8067:~# cd NX-API_CLI/VXLAN_BGP_EVPN/
root@a3d1f69d8067:~/NX-API_CLI/VXLAN_BGP_EVPN# ./1.Create_L2VNI.py vteps 42 42000 239.1.1.1 e1/41
#CLUS © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
[user@server ~]# docker run -it ndelecro/nexus9k-programmability:latest
Status: Downloaded newer image for docker.io/ndelecro/nexus9k-programmability:latest
root@a3d1f69d8067:~# cd NX-API_CLI/VXLAN_BGP_EVPN/
root@a3d1f69d8067:~/NX-API_CLI/VXLAN_BGP_EVPN# ./1.Create_L2VNI.py vteps 42 42000 239.1.1.1 e1/41
****** VTEP 93180-EX-1 ******
vlan 42
vn-segment 42000
int nve1
member vni 42000
mcast-group 239.1.1.1
suppress-arp
evpn
vni 42000 l2
rd auto
route-target import auto
route-target export auto
int e1/41
switchport access vlan 42
#CLUS © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Preview: NX-API Rollback on Error
NX-OS 9.2(1) release (Q3CY18)
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 46
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 47
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 48
Agenda
• Extending NX-OS
• Guest Shell
• NX-SDK
• Automating NX-OS
• NX-API
• Ansible
• NETCONF and YANG
• YDK
• Monitoring NX-OS
• Streaming Telemetry
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 49
Ansible
Overview
• Ansibles automates most DC assets with a
Management Server minimal learning curve.
• Both network and servers can be
Ansible Controller
managed.
Inventory Modules • Human-readable very little scripting
skills required.
• Agent-less easy to adopt.
Playbooks Config
• NX-OS: Ansible modules abstract the CLI.
• Advanced features:
Configure
• Variables • Events
• Conditionals • Loops
Switch or Server
#CLUS © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
• Inventory: target
Architecture systems for
automation.
Targets • Playbook: a series
of plays
Inventory (automation tasks).
• Modules:
accomplish specific
tasks in Ansible
(e.g. install
SSH packages,
Ansible configure NX-OS,
Playbook Python
Config etc.)
NX-API
• Ansible Config:
determines how
your Ansible setup
behaves (how many
Modules concurrent
connections, etc.)
#CLUS © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Ansible Playbook = Sequence of Tasks to Execute
Example: Deploy NTP on all the Servers
Set of target devices (defined in a separate file)
[user@server ~]# cat vxlan.yml
---
- hosts: all sudo For all those target devices,
become: yes execute the tasks below
tasks:
- name: Ensure NTP is installed Arguments to
yum: name=ntp state=present the module
- name: Ensure NTP is running
service: name=ntpd state=started enabled=yes
[user@server ~]#
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 54
VXLAN BGP EVPN Automation
[user@server ~]# cat vxlan.yml
---
- name: Create L2VNI
hosts: nxos_vteps
tasks:
- name: Create VLAN and map to to VNI
nxos_vlan:
vlan_id: 2200
mapped_vni: 20200
provider: "{{ nxapi_provider }}”
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 55
VXLAN BGP EVPN Automation
[user@server ~]# cat vxlan.yml [user@server ~]# cat /etc/ansible/hosts
--- [nxos_vteps]
- name: Create L2VNI 93180-EX-1
hosts: nxos_vteps 93180-EX-2
92160-1
tasks:
92160-2
- name: Create VLAN and map to to VNI
nxos_vlan:
93180-FX-2
vlan_id: 2200 ...
mapped_vni: 20200
provider: "{{ nxapi_provider }}” [user@server ~]# cat
/etc/ansible/group_vars/nxos_vteps
- name: Add L2VNI to Overlay ---
nxos_vxlan_vtep_vni: ansible_connection: local
interface: nve1 nxapi_provider:
vni: 20200 username: admin
... password: cisco
transport: nxapi
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 56
VXLAN BGP EVPN Automation
[user@server ~]# cat vxlan.yml
...
tasks:
- name: Create VLAN and map to to VNI
nxos_vlan: vlan 2200
vlan_id: 2200 vn-segment 20200
mapped_vni: 20200
provider: "{{ nxapi_provider }}”
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 57
VXLAN BGP EVPN Automation
[user@server ~]# cat vxlan.yml
...
- name: Add L2VNI to EVPN evpn
nxos_evpn_vni: vni 20200 l2
vni: 20200 rd auto
route_distinguisher: auto route-target import auto
route_target_both: auto route-target export auto
provider: "{{ nxapi_provider }}"
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 58
VXLAN BGP EVPN Automation
[user@server ~]# ansible-playbook vxlan_nxapi.yml
PLAY [Create L2VNI] ************************************************************
[user@server ~]# #CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 59
What’s the Cleanest Way to Handle This Error?
[user@server ~]# cat vxlan.yml Config prior to the playbook
... execution:
tasks:
- name: Create VLAN and map to to VNI
nxos_vlan: interface nve1
vlan_id: 2200 no shutdown
mapped_vni: 20200 host-reachability protocol bgp
admin_state: up member vni 20200
provider: "{{ nxapi_provider }}” suppress-arp
ingress-replication protocol bgp
- name: Add L2VNI to Overlay
nxos_vxlan_vtep_vni:
interface: nve1
vni: 20200
multicast_group: 239.239.239.100
suppress_arp: true
provider: "{{ nxapi_provider }}"
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 60
[user@server ~]# cat rollback.yml
...
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 62
[user@server ~]# ansible-playbook rollback.yml
TASK [Create checkpoint]
*************************************************************************************************
changed: [93180-FX-2]
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 63
[user@server ~]# ansible-playbook rollback.yml
TASK [Create checkpoint]
*************************************************************************************************
changed: [93180-FX-2]
PLAY RECAP
*************************************************************************************************
93180-FX-2 : ok=5 changed=3 unreachable=0 failed=1
[user@server ~]# #CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 64
[user@server ~]# ansible-playbook rollback.yml
TASK [Create checkpoint]
*************************************************************************************************
changed: [93180-FX-2]
tasks:
- name: Get the NX-OS version
nxos_facts:
gather_subset: "!interfaces"
provider: "{{ nxapi_provider }}"
- debug:
var: ansible_net_version
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 66
Apply a Patch Based on the NX-OS Version
--- TASK [Get the NX-OS version] ***************
- name: Patch ok: [93180-FX-2]
hosts: nxos_vteps_nxapi ok: [92160-1]
vars: ok: [93180-EX-1]
my_patch: nxos.CSCve91311_n9000.rpm
my_ver: 7.0(3)I6(1) TASK [debug] *******************************
ok: [93180-EX-1] => {
tasks: "ansible_net_version": "7.0(3)I6(1)"
- name: Get the NX-OS version }
nxos_facts: ok: [92160-1] => {
gather_subset: "!interfaces" "ansible_net_version": "7.0(3)I7(2)"
provider: "{{ nxapi_provider }}" }
ok: [93180-FX-2] => {
- debug: "ansible_net_version": "7.0(3)I7(3)"
var: ansible_net_version }
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 67
If the Patch Was Applied, Display the OSPF State
tasks: TASK [Apply OSPF patch] ********************
... skipping: [92160-1]
- name: Apply OSPF patch skipping: [93180-FX-2]
nxos_smu: ok: [93180-EX-1]
pkg: "{{ my_patch }}"
provider: "{{ nxapi_provider }}" RUNNING HANDLER [Get OSPF neighbors] *******
when: ansible_net_version == "{{ my_ver }}” ok: [93180-EX-1]
notify:
- Get OSPF neighbors RUNNING HANDLER [Display OSPF neighbors] ***
- Display OSPF neighbors ok: [93180-EX-1] => {
"ospf_neighbors": {
handlers: ...
- name: Get OSPF neighbors "addr": "10.0.0.2",
nxos_command: "drstate": " -",
commands: ["show ip ospf neighbors"] "intf": "Eth1/49",
provider: "{{ nxapi_provider }}" "priority": "1",
register: ospf_neighbors "rid": "100.100.100.100",
"state": "FULL",
- name: Display OSPF neighbors "uptime": "PT1M2S"
debug:
var: ospf_neighbors
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 68
NX-OS Ansible Modules
Over 70 NX-OS Modules in Ansible 2.5
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 70
Get Started With Just Two Commands
Ready-to-use Docker container with Ansible installed and configured, and
NX-OS playbooks available:
[user@server ~]# docker run -it ndelecro/nexus9k-programmability:latest
Status: Downloaded newer image for docker.io/ndelecro/nexus9k-programmability:latest
root@a3d1f69d8067:~#
#CLUS © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Get Started With Just Two Commands
Ready-to-use Docker container with Ansible installed and configured, and
NX-OS playbooks available:
[user@server ~]# docker run -it ndelecro/nexus9k-programmability:latest
Status: Downloaded newer image for docker.io/ndelecro/nexus9k-programmability:latest
root@a3d1f69d8067:~# ansible-playbook ~/ansible/vxlan_nxapi.yml
PLAY RECAP
*************************************************************************************************
93180-EX-1 : ok=1 changed=1 unreachable=0 failed=0
93180-FX-2 : ok=1 changed=1 unreachable=0 failed=0
root@a3d1f69d8067:~#
#CLUS © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Agenda
• Extending NX-OS
• Guest Shell
• NX-SDK
• Automating NX-OS
• NX-API
• Ansible
• NETCONF and YANG
• YDK
• Monitoring NX-OS
• Streaming Telemetry
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 73
NETCONF and
YANG
See Something Cool Here?
[user@server]$ python netconfclient.py ssh 93180-EX-2
Connecting to the NETCONF agent using the SSH protocol at 93180-EX-2:830.
User admin.
Using NETCONF version 1.1.
Response timeout value is 60 seconds.
Request exec count 1.
Connected to NETCONF agent. Waiting for <hello> message...
Before 7.0(3)I6(1): only the base capability is supported. Any changes get
directly applied to running config.
New capabilities since NX-OS 7.0(3)I6(1):
The candidate config temporarily holds any changes you make, without
changing the running configuration.
Validate the candidate config: the switch verifies the consistency of this
candidate config, SW and HW resources availability, etc.
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 77
New NETCONF Capabilities Support in 7.0(3)I6(1)
Greater Stability and Consistency
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 78
New NETCONF Capabilities Support in 7.0(3)I6(1)
Greater Stability and Consistency
• If an error occurs during the config processing, it will roll back to the
original state.
• “All-or-nothing” edit mode.
• Use case example: large ACL that could exceed the TCAM. If the TCAM
gets exhausted in the middle of the ACL programming, we don’t want to
end up with half of the ACL active. We would rather roll back to a clean
state.
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 79
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 80
A Simple YANG Model
YANG defines the basic blocks of syntax to define data in a tree hierarchy.
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 81
A Simple YANG Model
YANG defines the basic blocks of syntax to define data in a tree hierarchy.
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 82
A Simple YANG Model
YANG defines the basic blocks of syntax to define data in a tree hierarchy.
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 83
Who Defines YANG Models?
Model URL
IEEE https://github.com/YangModels/yang/tree/master/standard/ieee
IETF https://github.com/YangModels/yang/tree/master/standard/ietf
OpenConfig https://github.com/openconfig/public
Cisco https://github.com/YangModels/yang/tree/master/vendor/cisco
Juniper https://github.com/YangModels/yang/tree/master/vendor/juniper
More…
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 84
Source: https://pc.nanog.org/static/published/meetings/NANOG71/1535/20171004_Shaikh_Lightning_Talk_Openconfig_v1.pdf
#CLUS © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 85
NX-OS OpenConfig Support
Core Feature Set for Multi-Vendor Solution
Model Shipping NX-OS 9.2(1) – Q3CY18 End of 2018 Release – In Planning
ACL 1.0.0 1.0.0
BGP 2.1.0 (partial) 4.0.1 4.0.1
Interfaces 1.0.2 (partial) 2.0.0 2.0.0
Local Routing 1.0.0 (partial) 1.0.0 1.0.0
Network Instance (VRF) 0.8.1 0.8.1
OSPF 0.1.1 0.1.1
Platform including LC,
0.8.0 0.8.0
port, transceiver
Routing Policy 2.0.1 2.0.1 2.0.1
STP 0.2.0 0.2.0
System 0.3.0
RIB 0.2.0
VLAN 1.0.2 (partial) 1.0.2 2.0.0
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 86
NX-OS Native YANG Support
For the Complete Feature-Set
• ACL • OSPF
• QoS • HSRP
• Segment Routing • Syslog
• VXLAN F&L and BGP EVPN • NTP
• ARP • Route Policy
• Interfaces • HSRP
• VLAN • L2 and L3 Tables
• IPv4 and IPv6 for interfaces • SNMP
• RBAC • MPLS
• Tunnels • Static Route
• VRRPv2 and v3 • Streaming Telemetry Configuration
Supported protocols for OpenConfig and Native models are NETCONF, RESTCONF, and gRPC.
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 87
How do we create YANG payloads?
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 88
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 89
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 90
Then send those payloads with the
usual NETCONF / RESTCONF
methods.
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 91
But Let’s Take a Step Back…
YANG CLI
<System> vlan 123
<bd-items> vn-segment 90001
<bd-items>
<BD-list>
<fabEncap>vlan-123</fabEncap>
<accEncap>vxlan-90001</accEncap>
</BD-list>
</bd-items>
</bd-items>
</System>
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 92
But Let’s Take a Step Back…
YANG CLI
<System> vlan 123
<bd-items> vn-segment 90001
<bd-items>
Interface for machines
<BD-list>
API = <fabEncap>vlan-123</fabEncap>
Application Programming Interface for humans
Interface
<accEncap>vxlan-90001</accEncap>
</BD-list>
</bd-items>
</bd-items>
</System>
It’s not efficient to have a human manually deal with YANG payloads!
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 93
Ansible Can Help
vxlan.yml playbook
---
- name: VXLAN NETCONF
hosts: netconf_vteps
tasks:
- name: VXLAN
netconf_config:
datastore: running
src: vxlan.xml
#CLUS © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Ansible Can Help
vxlan.yml playbook vxlan.xml payload
--- <config>
- name: VXLAN NETCONF <System xmlns="http://cisco.com/ns/...">
hosts: netconf_vteps <bd-items>
<bd-items>
tasks: <BD-list>
- name: VXLAN <fabEncap>vlan-123</fabEncap>
netconf_config: <accEncap>vxlan-90001</accEncap>
datastore: running <name>ansible</name>
src: vxlan.xml </BD-list>
</bd-items>
</bd-items>
</System>
</config>
• Monitoring NX-OS
• Streaming Telemetry
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 102
YDK
Beyond Payloads: Code APIs
• It can be complicated and time-
consuming to create YANG XML
payloads manually.
• It also doesn’t fit very well with
automation via scripting. We would
have to do text manipulation to insert
the dynamic data into the payload
(even though Jinja can help...)
• Let’s generate a library of classes
(code API) that follows exactly the
YANG model definition.
• Let’s also abstract the communication
to the device.
#CLUS © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
YANG Development Kit
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 105
Telnet NX-API
NETCONF NX-API SNMP
or
Client Client
REST
Client
Client YDK APIs
SSH
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Model-Driven Programmability Stack Model-Driven
Configuration
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 107
YDK Pre-Generated APIs Support
• Languages supported for all APIs below:
• Python (ydk-py)
• C++ (ydk-cpp)
• Go (ydk-go)
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 108
Demo: VXLAN BGP EVPN Automation on
NX-OS with YDK
YDK “Hello World” Using OpenConfig
What happens when
crud.create() is invoked?
1. Validate that 65000 is a
valid AS number.
2. Convert the object to XML.
3. Build the netconf RPC for
an "edit-config”, and plug
the XML payload inside.
4. Send it to the switch.
5. Wait for the response from
the switch.
6. Process return code from
the switch: either end here,
or rollback.
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 110
YDK is the Ultimate Goal in Model-Driven Programmability
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 111
Comparison of YANG Frameworks
100
90
80
70
60
50
40
30
20
10
0
Automated Data model Transport NETCONF Error handling Scalability Coding skills
payload validation abstraction options required
generation
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 112
Agenda
• Extending NX-OS
• Guest Shell
• NX-SDK
• Automating NX-OS
• NX-API
• Ansible
• YANG and OpenConfig
• YDK
• Monitoring NX-OS
• Streaming Telemetry
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 113
Monitoring NX-OS with
Streaming Telemetry
Software Streaming Telemetry
Analytics-Ready Consumption
#CLUS © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Telemetry Receiver
Policy
Telemetry Engine Config
System
• Interval-based or event-based.
• Precise trigger definition.
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 119
Stream Interface Counters
interface Ethernet1/41
switchport
switchport access vlan 42
no shutdown
telemetry
sensor-group 1
path sys/intf/phys-[eth1/41]-dbgIfIn depth 0
#CLUS © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Stream ACL Counters Above a Given Threshold
ip access-list CLUS
statistics per-entry
10 permit ip 192.168.200.0/24 any
telemetry
sensor-group 1
path sys/acl/ipv4/name-CLUS/seq-10 depth 0 filter-condition gt(ipv4aclACE.packets,”10000”)
#CLUS © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Stream a VLAN When It Goes Down
vlan 2202
name tenant-20000_Backup
vn-segment 20202
telemetry
sensor-group 1
path sys/bd/bd-[vlan-2202] depth 0 filter-condition and(updated(l2BD.operSt),eq(L2BD.operSt,”down”)
#CLUS © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Preview: Streaming Telemetry of YANG Models
NX-OS 9.2(1) release (Q3CY18)
#CLUS © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Collector Output
#CLUS © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Streaming Telemetry At Scale
Spine Spine Spine Spine
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 125
Telemetry Collectors
Python Telemetry Collector
Receives JSON over HTTP
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Python Telemetry Collector
Receives JSON over HTTP
https://github.com/ndelecro/Nexus-9K-Programmability/blob/master/Streaming_Telemetry/HTTP_Transport/
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
ELK Telemetry Collector
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 129
Preview: DCNM Telemetry Collector
DCNM 11 Release (Q3CY18)
#CLUS © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
#CLUS © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
#CLUS © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
#CLUS © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
NX-SDK Integration with Streaming Telemetry
NX-OS 7.0(3)I7(3)
• In your NX-SDK app, define a custom “show” command that displays your data in a
JSON output.
• Configure the streaming telemetry sensor-group to call this CLI.
telemetry
destination-group 1
ip address 10.60.0.96 port 5000 protocol HTTP encoding JSON
sensor-group 1
path “show my_nx-sdk_app json” depth 0
subscription 1
dst-grp 1
snsr-grp 1 sample-interval 10000
• In a future release, NX-SDK will provide an API to inject streaming telemetry events
directly from the code. This will bring event-based telemetry support for NX-SDK apps.
#CLUS © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Demo: NX-SDK Integration with Streaming
Telemetry
1. User configures link threshold via new custom CLI
10G link 2. App automatically detect ECMP bundles
3. If the bandwidth usage of a ECMP link member exceeds
4G flow the threshold:
• Display a NX-OS syslog
• Create a streaming telemetry event
ECMP Bundle
#CLUS © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
1. User configures link threshold via new custom CLI
10G link 2. App automatically detect ECMP bundles
3. If the bandwidth usage of a ECMP link member exceeds
4G flow the threshold:
• Display a NX-OS syslog
• Create a streaming telemetry event
ECMP Bundle
#CLUS © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Feature-Set Availability Across Nexus Switching Family
N3K N5K/N6K/7K N9K
Guest Shell Yes No Yes
NX-SDK Yes No Yes
NX-API CLI Yes Yes Yes
YANG Yes (*) No Yes
YDK Yes (*) No Yes
Ansible Yes Yes Yes
Streaming
Yes (*) No Yes
Telemetry
(*) On models equipped with 8GB+ of memory.
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 138
+ Goodies
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 139
Resources
• N9K NX-OSv: https://www.cisco.com/c/en/us/td/docs/switches/datacenter/nexus9000/sw/7-x/nx-
osv/configuration/guide/b_NX-OSv_9000/b_NX-OSv_chapter_01.html
https://software.cisco.com/download/release.html?mdfid=286312239&softwareid=282088129&rel
ease=7.0(3)I7(2)
• N9K NX-OSv in VIRL: https://learningnetwork.cisco.com/docs/DOC-31788
• DevNet sandbox: https://developer.cisco.com/site/sandbox/
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 140
Resources (continued)
• YDK: https://developer.cisco.com/site/ydk/
• Streaming Telemetry
• Sample HTTP receiver: https://github.com/ndelecro/Nexus-9K-
Programmability/blob/master/Streaming_Telemetry/HTTP_Transport/http_receiver
.py
• Sample GPB receiver: http://docker.io/dockercisco/telemetryreceiver
• Demo of manual receiver: https://www.youtu.be/CDK0VdLArnM
• Demo of Kibana receiver: https://www.youtu.be/s2_Xq0hEL7c
• Deployment guide for VXLAN EVPN: https://developer.cisco.com/site/nx-
os/docs/guides/telemetryvxlan/Telemetry-Deployment-VXLAN-EVPN.pdf
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 141
Complete your online session evaluation
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 142
Continue
your Demos in
the Cisco
Walk-in
self-paced
Meet the
engineer
Related
sessions
education campus labs 1:1
meetings
#CLUS BRKDCN-2025 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 143
Thank you
#CLUS
#CLUS