cisco ios xr - clnv.s3.amazonaws.com · cisco ios xr programmability santiago Álvarez, tme david...

61

Upload: vuhuong

Post on 01-May-2018

248 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601
Page 2: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

Cisco IOS XR Programmability

Santiago Álvarez, TME

David Smith, PSE

LTRSPG-2601

Page 3: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

Cisco Spark

Questions? Use Cisco Spark to communicate with the speaker after the session

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

How

cs.co/ciscolivebot#LTRSPG-2601

Page 4: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

• Introduction

• Lab Test Bed

• Data Models

• NETCONF

• Google RPC

• Model-Driven APIs

• Ansible

• Resources

Agenda

Page 5: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

Motivations for Network Programmability

• Speed and scale demand software automation and data analytics

• Rapid innovation as competitive advantage

• One network operator per 1000s / 10000s of complex network devices

LTRSPG-2601 5

Page 6: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

Model-Driven Manageability

Encoding XML JSON GPB

Protocol NETCONF gRPCRESTCONF

Models

APIs

Apps

Model-Driven APIs

YANG Development Kit (YDK)

YANG Models

(native, open)

App App App

SSH HTTPTransport

Model-Driven

Configuration

Model-Driven

Telemetry

LTRSPG-2601 6

Page 7: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

Benefits of Model-Driven Manageability

• Model based, structured, computer friendly

• Multiple model types (native, OpenConfig, IETF, etc.)

• Models decoupled from transport, protocol and encoding

• Choice of transport, protocol and encoding

• Model-driven APIs for abstraction and simplification

• Wide standard support while leveraging open source

LTRSPG-2601 7

Page 8: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

Lab Test Bed

Page 9: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 9LTRSPG-2601

Test Bed Topology

192.168.255.1/32

(VRF RED)192.168.255.2/32

(VRF RED)

Out-of-band

networkNETCONF

gRPC

lo0

172.16.255.1/32

lo0

172.16.255.101/32

LER2LER1

g0/0/0/0

172.16.1.0/31

lo0

172.16.255.2/32

lo0

172.16.255.102/32

IS-IS L2

Area 49.0001

LSR1 LSR2

g0/0/0/2

172.16.2.4/31

198.18.1.127/24

198.18.1.111/24 198.18.1.112/24

g0/0/0/0

172.16.2.0/31

g0/0/0/1

172.16.2.2/31

g0/0/0/1

172.16.1.2/31

.0 .1

.2

.3

.4 .5 .1 .0

.3

.2

Controller

198.18.1.11/24 198.18.1.12/24

Page 10: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

General Instructions

• Take note of your session to access your respective test bed

• Sign your full name for your session in the spreadsheet and download lab guide

• Each session has a dedicated test bed that has been partially pre-configured

• The devices dedicated to a session are isolated from the devices assigned to other sessions

• Follow the tasks and steps in the order provided

• Explore the entire test bed and verify operation beyond the sample output provided

• Your session will be available until 23:00 on Feb 10, 2018

10LTRSPG-2601

Page 11: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 11LTRSPG-2601

Downloading Lab Material

• Connect to controller in your dCloud session

• Download material hosted on GitHub

11

admin@controller:~$ git clone https://github.com/111pontes/xr-pl2.git

Cloning into 'xr-pl2'...

remote: Counting objects: 1717, done.

remote: Compressing objects: 100% (379/379), done.

remote: Total 1717 (delta 505), reused 878 (delta 503), pack-reused 832

Receiving objects: 100% (1717/1717), 3.02 MiB | 186.00 KiB/s, done.

Resolving deltas: 100% (988/988), done.

Checking connectivity... done.

admin@controller:~$

admin@controller:~$ git clone https://github.com/CiscoDevNet/ydk-py-samples.git

Cloning into 'ydk-py-samples'...

remote: Counting objects: 6675, done.

remote: Total 6675 (delta 0), reused 0 (delta 0), pack-reused 6675

Receiving objects: 100% (6675/6675), 950.46 KiB | 373.00 KiB/s, done.

Resolving deltas: 100% (4506/4506), done.

Checking connectivity... done.

admin@controller:~$

Connect to controller in your dCloud session and download lab material hosted on GitHub:

Page 12: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

Data Models

Page 13: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

Data Models in Cisco IOS XR

• Data (config and operational) and actions/commands (RPCs) in a tree structure

• Self-documented and shipped with devices

• Native (XR specific) and open (vendor neutral) models

• Native models provide most coverage

• Open (OpenConfig and IETF) provide reduced coverage

• Open models internally mapped to native models

Native Open(OpenConfig / IETF)

LTRSPG-2601 13

Page 14: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

Cisco IOS XR Native Data Models

• Provide most comprehensive coverage for device functionality

• Approximately ~375 models in XR 6.3.1 (750+ YANG files)

• A single model defines either configuration (cfg), operational state (oper) or an action/command (act)

• Cisco-IOS-XR-ipv4-bgp-cfg

• Cisco-IOS-XR-ipv4-bgp-oper

• Cisco-IOS-XR-ipv4-bgp-act

• Models posted at

• https://github.com/YangModels/yang/tree/master/vendor/cisco/xr

LTRSPG-2601 14

Page 15: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

OpenConfig Data Models

• Operator group pursuing more dynamic and programmable networks

• Vendor-neutral data models (YANG)

• Models designed by operators for operators

• Model coverage still limited, but model development rapidly evolving

• New models in active development

• Actions/commands (RPCs) not defined using YANG

• gRPC network management interface (gNMI)

• gRPC network operations interface (gNOI)

LTRSPG-2601 15

Page 16: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

OpenConfig Data Models In Cisco IOS XR

• OpenConfig models mapped to native models

• Comprehensive support in Cisco IOS XR (as of 6.3.1)

• bgp, bgp-policy

• Interfaces, if-aggregate, if-ethernet, if-ip

• lacp

• local-routing

• mpls

• platform

• rib-bgp

• routing-policy

• telemetry

• vlan

• channel_monitor, terminal_device, optical_amplifier, transport_line_common, transport_line_protection, transport_types

Cisco IOS XR

Native

LTRSPG-2601 16

Page 17: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

YANG

• Modeling language for networking

• Defines data hierarchy (config or oper), RPCs and notifications

• Main node types

• Leaf – node with name, type and value (no children)

• Leaf list – sequence of leafs (no children)

• Container – node that groups nodes and has no type or value

• List – Series of data instances generally with one or more keys

• Models extended through augmentations

• Unsupported nodes specified as deviations

Leaf

Node without type/value

Node with a type/value

Leaf list

List

key

LTRSPG-2601 17

Container

Page 18: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

PYANG

• Open-source tool to validate and convert YANG models

• Useful tool for basic model exploration using model tree format

• Tree paths and tree depth options can be used as sliding window over model tree hierarchy

Model Tree

Tree path

Tree depth

LTRSPG-2601 18

Page 19: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

Browse Entire Model Hierarchy Using PYANG

$ pyang -f tree Cisco-IOS-XR-infra-infra-cfg.yang

module: Cisco-IOS-XR-infra-infra-cfg

+--rw banners

+--rw banner* [banner-name]

+--rw banner-name Banner

+--rw banner-text string

$

Container

List / key

Leafs / types

Configuration data

LTRSPG-2601 19

Page 20: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

PYANG Tree Format Keys

• [ ] - list key

• rw - read-write (configuration) data

• ro - read-only (state/operational) data

• ? - optional node

• ! - presence container

• * - list or leaf-list

• () - choice and case node

• : - case node

• ... - subtrees not shown

LTRSPG-2601 20

Page 21: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

NETCONF

Page 22: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

XML

NETCONF

NETCONF Protocol Overview

• Rich functionality to manage configuration and operational (state) data

• Operations defined as RPCs (request / reply) in XML

• Client/app initiate request towards server/device

• Supports running, candidate and startup configurations

• Capability exchange during session initiation

22

YANG

SSH

LTRSPG-2601

Page 23: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

Main NETCONF Protocol Operations

Operation Description

get-config Retrieve all or part of a specified configuration

edit-config

Loads all or part of a specified

configuration (merge, replace, create, delete,

remove)

copy-config Create or replace an entire configuration datastore

getRetrieve all or part of running configuration and device

operational data

get-schema Retrieve device schema (model)

lock Lock entire configuration datastore (e.g. candidate)

unlockRemove lock on entire configuration datastore (e.g.

candidate)

close-session Request graceful session termination

LTRSPG-2601 23

Page 24: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

NETCONF Edit-Config Operations

Operation Description

Merge Merge configuration with existing configuration (default)

Replace Replace configuration with existing configuration

CreateCreate configuration if non-existent. Otherwise, return

error. (non-idempotent*)

DeleteDelete configuration if existent. Otherwise, return error.

(non-idempotent)

RemoveRemove configuration. Ignore if configuration non-

existent.

* Cannot be applied multiple times without changing the result beyond the initial application

LTRSPG-2601 24

Page 25: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 25LTRSPG-2601

Testbed Topology (NETCONF)

Out-of-band

network

NETCONF

lo0

172.16.255.1/32

lo0

172.16.255.101/32

LER2LER1

g0/0/0/0

172.16.1.0/31

lo0

172.16.255.2/32

lo0

172.16.255.102/32

IS-IS L2

Area 49.0001

LSR1 LSR2

g0/0/0/2

172.16.2.4/31

198.18.1.127/24

198.18.1.111/24 198.18.1.112/24

g0/0/0/0

172.16.2.0/31

g0/0/0/1

172.16.2.2/31

g0/0/0/1

172.16.1.2/31

.0 .1

.2

.3

.4 .5 .1 .0

.3

.2

Controller

198.18.1.11/24 198.18.1.12/24

netconf

Page 26: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

Google RPC

Page 27: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

Cisco gRPC

CLIJSON

YANG

HTTP/2

Overview of gRPC on Cisco IOS XR

• Google RPC provides a general (open source) RPC framework

• Interface definition in Cisco IOS XR specifies device operations

• Functional subset of NETCONF

• Simple client development

• High performance

27LTRSPG-2601

Page 28: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

Protocol Operations in Cisco IDL

Operation Description

GetConfig Retrieve configuration

MergeConfig Merge configuration

DeleteConfig Delete configuration

ReplaceConfig Replace configuration

CommitReplace Replace entire configuration

GetOper Retrieve operational data

CliConfig Merge configuration data in CLI format

ShowCmdTextOutput Retrieves CLI show-command output data

LTRSPG-2601 28

Page 29: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 29LTRSPG-2601

Testbed Topology (gRPC)

Out-of-band

network

gRPC

lo0

172.16.255.1/32

lo0

172.16.255.101/32

LER2LER1

g0/0/0/0

172.16.1.0/31

lo0

172.16.255.2/32

lo0

172.16.255.102/32

IS-IS L2

Area 49.0001

LSR1 LSR2

g0/0/0/2

172.16.2.4/31

198.18.1.127/24

198.18.1.111/24 198.18.1.112/24

g0/0/0/0

172.16.2.0/31

g0/0/0/1

172.16.2.2/31

g0/0/0/1

172.16.1.2/31

.0 .1

.2

.3

.4 .5 .1 .0

.3

.2

Controller

198.18.1.11/24 198.18.1.12/24

grpcc

Page 30: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

Model-Driven APIs

ydk.io

Page 31: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

Model-Driven APIs

• Simplify app development

• One-to-one correspondence between model and class hierarchy

• Abstract protocol, transport, encoding, modeling language

• API generated from YANG model

• Automatic data validation

• Multi-language (Python, C++, Go, etc.)

YANG ModelClass Hierarchy

(Python, C++, Go)

LTRSPG-2601 31

Page 32: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

YDK Client-Side Validation

• Client will automatically perform local validation based on model constraints

• Check between type of data: config (read-write) and state (read-only)

• Type check (enum, string, etc.)

• Value check (range, pattern, etc.)

• Semantic check (key uniqueness/presence, mandatory leafs, etc.)

• Model deviation check (unsupported leafs, etc.)

Application

(client)

Device

(server)

LTRSPG-2601 32

Page 33: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

YDK API Structure

• Models group Python APIs created for each YANG model

• Services perform operations on model objects (interface)

• Providers implement services (implementation)

33

Models(BGP, IS-IS, etc)

Services(CRUD, NETCONF, Codec, Executor, etc.)

Providers(NETCONF, Codec, etc.)

LTRSPG-2601

Page 34: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

YANG Development Kit

Services

Providers

Cisco

IOS XR

Models

OpenConfig

Models

IETF

Models

Services

Providers

YDK-Py

Python

YDK-Cpp

C++

Cisco

IOS XE

Models

Cisco

IOS XR

Models

OpenConfig

Models

IETF

Models

Cisco

IOS XE

Models

LTRSPG-2601 34

Page 35: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

A YDK-Py “Hello World” Using OpenConfig BGP

# Cisco YDK-Py OC-BGP “Hello world”from ydk.services import CRUDServicefrom ydk.providers import NetconfServiceProviderfrom ydk.models.openconfig import openconfig_bgp as oc_bgp

if __name__ == "__main__":provider = NetconfServiceProvider(address=10.0.0.1,

port=830,username=“admin”,password=“admin”,protocol=“ssh”)

crud = CRUDService() # create CRUD servicebgp = oc_bgp.Bgp() # create oc-bgp objectbgp.global_.config.as_ = 65000 # set local AS numbercrud.create(provider, bgp) # create on NETCONF deviceprovider.close()exit()

# End of script

module: openconfig-bgp+--rw bgp

+--rw global| +--rw config| | +--rw as| | +--rw router-id?| +--ro state| | +--ro as| | +--ro router-id?| | +--ro total-paths?| | +--ro total-prefixes?

...

LTRSPG-2601 35

Page 36: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

Testbed Topology (YDK)

36

192.168.255.1/32

(VRF RED)192.168.255.2/32

(VRF RED)

Out-of-band

network

NETCONF

lo0

172.16.255.1/32

lo0

172.16.255.101/32

LER2LER1

g0/0/0/0

172.16.1.0/31

lo0

172.16.255.2/32

lo0

172.16.255.102/32

IS-IS L2

Area 49.0001

LSR1 LSR2

g0/0/0/2

172.16.2.4/31

198.18.1.127/24

198.18.1.111/24 198.18.1.112/24

g0/0/0/0

172.16.2.0/31

g0/0/0/1

172.16.2.2/31

g0/0/0/1

172.16.1.2/31

.0 .1

.2

.3

.4 .5 .1 .0

.3

.2

Controller

198.18.1.11/24 198.18.1.12/24

LTRSPG-2601 36

Page 37: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

Ansible

Page 38: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

Ansible Overview

• Configuration management, deployment, and orchestration engine

• Uses a push model

• Agentless (no special software required on remote machines)

• Extensible

• Open source

• Growing user community

• Growing support for network automation

38LTRSPG-2601

Page 39: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

Automation Concepts in Ansible

• Playbook - set of plays defining a particular piece of automation

• Specified in YAML

• Play - set of automation tasks across a set of hosts

• Task - Invocation of an Ansible module

• Module - small piece of code to perform a specific task

• Commonly implemented in Python

• JSON as input/output

39LTRSPG-2601

Playbook

Play

Play

Task

Task

Task

:

:

Module

Module

Page 40: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 40LTRSPG-2601

Playbook Example

---- name: Verify IPv4 VPN service

hosts: LERsconnection: localgather_facts: no

tasks:- name: Reachability of LER2 prefix for VRF RED

ip_destination_reachable:host: '{{ inventory_hostname }}'destination: '192.168.255.2'min_success_rate: 100vrf_name: 'RED'

Playbook

Play

Task

Module invocation

Page 41: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 41LTRSPG-2601

Ansible Connection Examples

Remote

Local

Connection (e.g. SSH)

Connection (e.g. NETCONF)

JSON

JSON

Module

Module

Page 42: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 42LTRSPG-2601

Test Bed Topology (Ansible)

192.168.255.1/32

(VRF RED)192.168.255.2/32

(VRF RED)

Out-of-band

network

NETCONF

lo0

172.16.255.1/32

lo0

172.16.255.101/32

LER2LER1

g0/0/0/0

172.16.1.0/31

lo0

172.16.255.2/32

lo0

172.16.255.102/32

IS-IS L2

Area 49.0001

LSR1 LSR2

g0/0/0/2

172.16.2.4/31

198.18.1.127/24

198.18.1.111/24 198.18.1.112/24

g0/0/0/0

172.16.2.0/31

g0/0/0/1

172.16.2.2/31

g0/0/0/1

172.16.1.2/31

.0 .1

.2

.3

.4 .5 .1 .0

.3

.2

Controller

198.18.1.11/24 198.18.1.12/24

Page 43: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

Resources

Page 44: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

Resources

Model-driven programmability @ Cloud-Scale Networking

• Model-Driven Programmability (http://goo.gl/x3GZDB)

Programmability @ XR Docs

• Tutorials (https://xrdocs.github.io/programmability/tutorials)

• Blogs (https://xrdocs.github.io/programmability/blogs)

Configuration guide

• Cisco IOS XR programmability configuration guide for ASR 9000 series router (http://goo.gl/8dYUeK)

• Cisco IOS XR programmability configuration guide for NCS 5500 series router (http://goo.gl/cnYPw7)

LTRSPG-2601 44

Page 45: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

Detailed YDK Resources

YDK Portal

• YDK at DevNet (http://ydk.io)

YDK Sample Apps

• YDK-Py sample apps (https://github.com/CiscoDevNet/ydk-py-samples) - Over 700 apps!

• YDK-Cpp sample apps (https://github.com/CiscoDevNet/ydk-cpp-samples) - Coming soon

Sandboxes

• dCloud YANG Development Kit sandbox (https://goo.gl/kaYJ3R)

• Ubuntu YDK Vagrant box (https://git.io/vaw1U)

Support

• Cisco support community (https://communities.cisco.com/community/developer/ydk)

LTRSPG-2601 45

Page 46: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

Detailed YDK Resources (cont.)

YDK Documentation

• YDK-Py docs (http://ydk.cisco.com/py/docs)

• YDK-Cpp docs (http://ydk.cisco.com/cpp/docs)

GitHub

• YDK Python API – YDK-Py (https://github.com/CiscoDevNet/ydk-py)

• YDK-Py sample apps (https://github.com/CiscoDevNet/ydk-py-samples) - Over 700 apps!

• YDK C++ API – YDK-Cpp (https://github.com/CiscoDevNet/ydk-cpp)

• YDK-Cpp sample apps (https://github.com/CiscoDevNet/ydk-cpp-samples) - Coming soon

LTRSPG-2601 46

Page 47: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

Detailed YDK Resources (cont.)

Conferences

• NANOG 68: Ok, We Got YANG Data Models. Now What? (http://youtu.be/2oqkiZ83vAA )

• NANOG 71: Getting started with OpenConfig (https://youtu.be/L7trUNK8NJI)

• LinuxCon NA 2016: Simplifying Network Programmability Using Model-Driven APIs (https://goo.gl/W6tH2X)

LTRSPG-2601 47

Page 48: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

Conclusion

Page 49: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 49LTRSPG-2601

Let’s Recap

• Model-Driven Programmability

• Speed and scale through automation

• Rich and flexible in terms of models, transports and encodings

• Data Models

• Native (full coverage, XR specific)

• OpenConfig (partial coverage, cross vendor)

• NETCONF

• Rich, mature protocol

• Relies on XML encoding

• Google RPC

• Cisco interface definition (device operations)

• Supports JSON and unstructured data (CLI)

• High performance

• Model-Driven APIs

• Simplify app development

• Abstract transport and encoding

• Ansible

• Simple, extensible, agentless automation engine

• Modules easily created using YDK

Page 50: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

Cisco Spark

Questions? Use Cisco Spark to communicate with the speaker after the session

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

How

cs.co/ciscolivebot#LTRSPG-2601

Page 51: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

• Please complete your Online Session Evaluations after each session

• 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/.

Complete Your Online Session Evaluation

Page 52: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 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

52LTRSPG-2601

Page 53: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

Continue Your Education

• Related sessions

• Model-driven programmability for Cisco IOS XR (BRKSPG-2303)

• Introduction to OpenConfig (DEVNET-1775)

• YDK and Model Driven Programmability with Python (BRKDEV-2632)

• Meet the Engineer 1:1 meetings

• Lunch & Learn

53LTRSPG-2601

Page 54: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

Thank you

Page 55: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601
Page 56: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

Backup

Page 57: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 57LTRSPG-2601

Cisco IOS XR Device Programmability

Data Plane

Control Plane

Management Plane

App

Controller

Orchestrator

Controller

Orchestrator

Data Plane

Control Plane

App

Model-Driven Manageability Service Layer API

Page 58: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

YANG Model Example

container community-sets {description “Container for community sets";list community-set {key community-set-name;description "Definitions for community sets";leaf community-set-name {

type string;description "name of the community set";

}leaf-list community-member {

type string {pattern '([0-9]+:[0-9]+)';

}description "members of the community set";

}}

}

community-setscommunity-set C-SET165172:1,65172:2,65172:3

!community-set C-SET1065172:10,65172:20,65172:30

!!

YANG CLI

LTRSPG-2601 58

Page 59: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

Model Data Example

<community-sets><community-set>

<community-set-name>C-SET1</community-set-name><community-member>65172:1</community-member><community-member>65172:2</community-member><community-member>65172:3</community-member>

</community-set><community-set>

<community-set-name>C-SET10</community-set-name><community-member>65172:10</community-member><community-member>65172:20</community-member><community-member>65172:30</community-member>

</community-set></community-sets>

community-setscommunity-set C-SET165172:1,65172:2,65172:3

!community-set C-SET1065172:10,65172:20,65172:30

!!

XML CLI

LTRSPG-2601 59

Page 60: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

Model Data Example

community-setscommunity-set C-SET1

65172:1,65172:2,65172:3

!community-set C-SET10

65172:10,65172:20,65172:30

!!

{ "community-sets": {"community-set": [

{ "community-set-name": "CSET1","community-member": [

"65172:1","65172:2","65172:3" ]

},{ "community-set-name": "CSET10",

"community-member": ["65172:10","65172:20","65172:30" ]

}]

}}

JSON CLI

LTRSPG-2601 60

Page 61: Cisco IOS XR - clnv.s3.amazonaws.com · Cisco IOS XR Programmability Santiago Álvarez, TME David Smith, PSE LTRSPG-2601