ok, we got yang data models, now what?d2zmdbbm9feqrf.cloudfront.net/2016/usa/pdf/devnet-2057.pdf ·...
TRANSCRIPT
Ok, We Got YANG Data Models, Now What?
Santiago Álvarez
DEVNET-2057
@111pontes
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
Protocol NETCONF gRPCRESTCONF
Encoding XML JSON
Model-Driven Programmability Stack
Models
APIs
Apps
Model-Driven APIs
YANG Development Kit (YDK)
YANG Models
(native, open)
App1 App2 App3
SSH HTTPTransport
DEVNET-2057 3
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
• Model based, structured, computer friendly
• Multiple model types (native, common, OpenConfig, IETF, etc.)
• Models decoupled from transport, protocol end encoding
• Choice of transport, protocol and encoding
• Model-driven APIs for abstraction and simplification
• Wide standard support while leveraging open source
Benefits of Model-Driven Programmability
DEVNET-2057 4
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
• Model structures data (config and operational) as a tree
• Models files are self-documented and ship with devices
• Cisco IOS XR supports 180+ YANG models (config and operational) in release 6.0.1
• Native models provide most coverage
• OpenConfig support: BGP, Routing Policy, MPLS, Interfaces
• OpenConfig and IETF models are mapped to native models
Data Models
Native / Common OpenConfig / IETF
DEVNET-2057 5
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
• Simplify app development
• Abstract transport, encoding, modeling language
• API generated from YANG model
• One-to-one correspondence between model and class hierarchy
• Multi-language (Python, C++, Ruby, Go, etc.)
Model-Driven APIs
YANG ModelClass Hierarchy
(Python, C++, Ruby, Go)
DEVNET-2057 6
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
Generation of Model-Driven APIs Using YANG Development Kit (YDK)
YAN
G
YANG
YANG
Data
Models
(YANG)
API
Generator
DocsPython
C++
: :
Ruby
go
Docs
Docs
Docs
C♯ Docs
YDK-gen
YDK-Py
YDK
DEVNET-2057 7
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
• YDK service will automatically perform local (client-side) validation
• Type check (enum, string, etc.)
• Value check (range, pattern, etc.)
• Semantic check (key uniqueness/presence, mandatory leafs, etc.)
• Model deviation check
Client-Side Validation
Application
(client)
Device
(server)
DEVNET-2057 8
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
# Cisco YDK-Py OC-BGP “Hello world”from ydk.services import CRUDServicefrom ydk.providers import NetconfServiceProviderfrom ydk.models.bgp import bgp
if __name__ == "__main__":provider = NetconfServiceProvider(address=10.0.0.1,
port=830,username=“admin”,password=“admin”,protocol=“ssh”)
crud = CRUDService() # create CRUD servicebgp = 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
A YDK-Py “Hello World” Using OC-BGP
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?
...
DEVNET-2057 9
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
GitHub
• Cisco IOS XR YANG models (https://git.io/vg7fk)
• Getting Started With OpenConfig in Cisco IOS XR (https://git.io/vg7vF)
• Getting Started With gRPC in Cisco IOS XR (https://git.io/vg7vP)
• YDK Python API – YDK-Py (https://git.io/vaWsg)
• YDK-Py sample apps (https://git.io/vaw1U)
• YDK Generator – YDK-gen (https://git.io/vaw1M)
• YANG Explorer (https://git.io/vg7Jm)
Resources
DEVNET-2057 10
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
DevNet
• YDK at DevNet (https://goo.gl/Wqwp3C)
• Cisco IOS XR 6.0 at DevNet (https://goo.gl/uaxrpN)
YDK Sandboxes
• Ubuntu YDK-PY Vagrant box (https://git.io/vaw1U)
• YDK on dCloud (http://dcloud.cisco.com.com)
YDK Support
• Cisco support community (https://communities.cisco.com/community/developer/ydk)
Resources (cont.)
DEVNET-2057 11
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
Other
• Cisco Blogs (http://goo.gl/hBnkp2)
Resources (cont.)
DEVNET-2057 12
Questions?
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
Complete Your Online Session Evaluation
Don’t forget: Cisco Live sessions will be available for viewing on-demand after the event at CiscoLive.com/Online
• Give us your feedback to be entered into a Daily Survey Drawing. A daily winner will receive a $750 Amazon gift card.
• Complete your session surveys through the Cisco Live mobile app or from the Session Catalog on CiscoLive.com/us.
14DEVNET-2057
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
Continue Your Education
• Related sessions
DEVNET-2057 - Ok, We Got YANG Data Models, Now What?
DEVNET-1070 - Using YANG to Define Device and Service Configuration and Operations
DEVNET-2044 - NETCONF/RESTCONF/YANG API
DEVNET-1216 - NETCONF and YANG Enablement of Network Devices
TECNMS-2009 - NETCONF/YANG Modeling
• Walk-in Self-Paced Labs
• Table Topics
• Meet the Engineer 1:1 meetings
15DEVNET-2057
Thank you
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
• Speed and scale demand software automation and data analytics
• Rapid innovation as competitive advantage
• One network operator per 1000s / 10000s of complex network devices
Motivations for Network Programmability
DEVNET-2057 18
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
• Modeling language (initially for NETCONF)
• Main node types
• Leaf – node with name and value of certain type (no children)
• Leaf list – sequence of leafs
• Container – groups nodes and has no value
• List – Sequence of records with key leafs
• Deviations document data not implemented in non-native model
YANG
Leaf
Node without a value
Node with a value
Leaf list
Container
(grouping)
Container
(presence)
List
key
DEVNET-2057 19
© 2016 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-set CSET165172:1,65172:2,65172:3
end-set!community-set CSET1065172:10,65172:20,65172:30
end-set!
YANG CLI
DEVNET-2057 20
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
Model Data Example
<community-sets><community-set>
<community-set-name>CSET1</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>CSET10</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-set CSET165172:1,65172:2,65172:3
end-set!community-set CSET1065172:10,65172:20,65172:30
end-set!
XML CLI
DEVNET-2057 21
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
Model Data Example
community-set CSET165172:1,65172:2,65172:3
end-set!community-set CSET1065172:10,65172:20,65172:30
end-set!
{ "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
DEVNET-2057 22
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
YDK-Py API Structure
Models(BGP, IS-IS, etc)
Services(CRUD, NETCONF, etc.)
Providers(NETCONF, Codec, etc.)
• Models group Python APIs created for each YANG model (auto-generated)
• Services perform operations on model objects (interface)
• Providers implement services (implementation)
DEVNET-2057 23
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
XMLJSON
RESTCONF
YANG
HTTP / HTTPS
• RESTful API for NETCONF
• Functional subset of NETCONF
• Single hierarchy of resources (data + allowed methods)
• Resource hierarchy rooted at ‘restconf/’
• Configuration and operational data located under ‘restconf/data’
• Web app friendly
RESTCONF Protocol Overview
DEVNET-2057 24
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
Main RESTCONF Protocol Operations
Operation Description
GETRetrieve data for a resource
(config/operational)
POST Create a configuration data resource
PUTCreate or replace a configuration data
resource
PATCHMerge configuration data with target
resource
DELETE Delete a configuration data resource
DEVNET-2057 25
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
XML
NETCONF
• 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
NETCONF Protocol Overview
YANG
SSH
DEVNET-2057 26
© 2016 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-configLoad all or part of a specified
configuration (merge, replace, create, delete, remove)
commit Implement candidate configuration
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)
unlock Remove lock on entire configuration datastore (e.g. candidate)
close-session Request graceful session termination
DEVNET-2057 27
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
Cisco gRPC
CLIJSON
YANG
HTTP/2
• 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
Overview of gRPC on Cisco IOS XR
DEVNET-2057 28
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
Protocol Operations in Cisco IDL
Operation Description
GetConfig Retrieve configuration data
MergeConfig Merge configuration data
DeleteConfig Delete configuration data
ReplaceConfig Replace configuration data
GetOper Retrieve operational data
CliConfig Merge configuration data in CLI format
ShowCmdTextOutput Retrieves CLI show-command output data
DEVNET-2057 29
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
R&S Related Cisco Education OfferingsCourse Description Cisco Certification
CCIE R&S Advanced Workshops (CIERS-1 &
CIERS-2) plus
Self Assessments, Workbooks & Labs
Expert level trainings including: instructor led workshops, self
assessments, practice labs and CCIE Lab Builder to prepare candidates
for the CCIE R&S practical exam.
CCIE® Routing & Switching
• Implementing Cisco IP Routing v2.0
• Implementing Cisco IP Switched
Networks V2.0
• Troubleshooting and Maintaining
Cisco IP Networks v2.0
Professional level instructor led trainings to prepare candidates for the
CCNP R&S exams (ROUTE, SWITCH and TSHOOT). Also available in
self study eLearning formats with Cisco Learning Labs.
CCNP® Routing & Switching
Interconnecting Cisco Networking Devices:
Part 2 (or combined)
Configure, implement and troubleshoot local and wide-area IPv4 and IPv6
networks. Also available in self study eLearning format with Cisco Learning
Lab.
CCNA® Routing & Switching
Interconnecting Cisco Networking Devices:
Part 1
Installation, configuration, and basic support of a branch network. Also
available in self study eLearning format with Cisco Learning Lab.
CCENT® Routing & Switching
30
For more details, please visit: http://learningnetwork.cisco.com
Questions? Visit the Learning@Cisco Booth or contact [email protected]
DEVNET-2057
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
Service Provider Cisco Education OfferingsCourse Description Cisco Certification
Deploying Cisco Service Provider Network Routing
(SPROUTE) & Advanced (SPADVROUTE)
Implementing Cisco Service Provider Next-Generation
Core Network Services (SPCORE)
Edge Network Services (SPEDGE)
SPROUTE covers the implementation of routing protocols (OSPF, IS-IS, BGP),
route manipulations, and HA routing features; SPADVROUTE covers advanced
routing topics in BGP, multicast services including PIM-SM, and IPv6;
SPCORE covers network services, including MPLS-LDP, MPLS traffic engineering,
QoS mechanisms, and transport technologies;
SPEDGE covers network services, including MPLS Layer 3 VPNs, Layer 2 VPNs,
and Carrier Ethernet services; all within SP IP NGN environments.
CCNP Service Provider®
Building Cisco Service Provider Next-Generation
Networks, Part 1&2 (SPNGN1), (SPNGN2)
The two courses introduce networking technologies and solutions, including OSI
and TCP/IP models, IPv4/v6, switching, routing, transport types, security, network
management, and Cisco OS (IOS and IOS XR).
CCNA Service Provider®
Implementing Cisco Service Provider Mobility UMTS
Networks (SPUMTS);
Implementing Cisco Service Provider Mobility CDMA
Networks (SPCDMA);
Implementing Cisco Service Provider Mobility LTE
Networks (SPLTE)
The three courses (SPUMTS, SPCDMA, SPLTE) cover knowledge and skills
required to understand products, technologies, and architectures that are found in
Universal Mobile Telecommunications Systems (UMTS) and Code Division Multiple
Access (CDMA) packet core networks, plus their migration to Long-Term Evolution
(LTE) Evolved Packet Systems (EPS), including Evolved Packet Core (EPC) and
Radio Access Networks (RANs).
Cisco Service Provider Mobility
CDMA to LTE Specialist;
Cisco Service Provider Mobility UMTS
to LTE Specialist
Implementing and Maintaining Cisco Technologies
Using IOS XR (IMTXR)
Service Provider/Enterprise engineers to implement, verification-test, and optimize
core/edge technologies in a Cisco IOS XR environment.
Cisco IOS XR Specialist
For more details, please visit: http://learningnetwork.cisco.com
Questions? Visit the Learning@Cisco Booth or contact [email protected]
31DEVNET-2057
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
Data Center / Virtualization Cisco Education OfferingsCourse Description Cisco Certification
Introducing Cisco Data Center Networking (DCICN);
Introducing Cisco Data Center Technologies (DCICT)
Learn basic data center technologies and skills to build a
data center infrastructure.
CCNA® Data Center
Implementing Cisco Data Center Unified Fabric (DCUFI);
Implementing Cisco Data Center Unified Computing (DCUCI)
Designing Cisco Data Center Unified Computing (DCUDC)
Designing Cisco Data Center Unified Fabric (DCUFD)
Troubleshooting Cisco Data Center Unified Computing
(DCUCT)
Troubleshooting Cisco Data Center Unified Fabric (DCUFT)
Obtain professional level skills to design, configure,
implement, troubleshoot data center network infrastructure.
CCNP® Data Center
Product Training Portfolio: DCNMM, DCAC9K, DCINX9K,
DCMDS, DCUCS, DCNX1K, DCNX5K, DCNX7K
Gain hands-on skills using Cisco solutions to configure,
deploy, manage and troubleshoot unified computing, policy-
driven and virtualized data center network infrastructure.
Designing the FlexPod® Solution (FPDESIGN);
Implementing and Administering the FlexPod® Solution
(FPIMPADM)
Learn how to design, implement and administer FlexPod
solutions
Cisco and NetApp Certified
FlexPod® Specialist
32
For more details, please visit: http://learningnetwork.cisco.com
Questions? Visit the Learning@Cisco Booth or contact [email protected]
DEVNET-2057
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public
Network Programmability Cisco Education OfferingsCourse Description Cisco Certification
Integrating Business Applications with Network
Programmability (NIPBA);
Integrating Business Applications with Network
Programmability for Cisco ACI (NPIBAACI)
Learn networking concepts, and how to deploy and troubleshoot
programmable network architectures with these self-paced courses.
Cisco Business Application
Engineer Specialist Certification
Developing with Cisco Network Programmability
(NPDEV);
Developing with Cisco Network Programmability
for Cisco ACI (NPDEVACI)
Learn how to build applications for network environments and effectively
bridge the gap between IT professionals and software developers.
Cisco Network Programmability
Developer Specialist Certification
Designing with Cisco Network Programmability
(NPDES);
Designing with Cisco Network Programmability
for Cisco ACI (NPDESACI)
Learn how to expand your skill set from traditional IT infrastructure to
application integration through programmability.
Cisco Network Programmability
Design Specialist Certification
Implementing Cisco Network Programmability
(NPENG);
Implementing Cisco Network Programmability
for Cisco ACI (NPENGACI)
Learn how to implement and troubleshoot open IT infrastructure
technologies.
Cisco Network Programmability
Engineer Specialist Certification
For more details, please visit: http://learningnetwork.cisco.com
Questions? Visit the Learning@Cisco Booth or contact [email protected]
33DEVNET-2057