YANG Boot Camp - PowerPoint PPT Presentation

1 / 28
About This Presentation
Title:

YANG Boot Camp

Description:

Left content and data models for future work. Operations allow any XML ... class free-loader /class /user user name rzull /name full-name Repun /full-name ... – PowerPoint PPT presentation

Number of Views:85
Avg rating:3.0/5.0
Slides: 29
Provided by: Juni153
Category:
Tags: yang | boot | camp | freeloader | mumble

less

Transcript and Presenter's Notes

Title: YANG Boot Camp


1
(No Transcript)
2
YANG Boot Camp
  • The YANG Gang
  • IETF 71

3
NETCONF Modeling Language
  • NETCONF base protocol (rfc 4741)
  • RPC mechanism and operations
  • Left content and data models for future work
  • Operations allow any XML
  • ltgetgt, ltget-configgt and ltedit-configgt

Mgmt Application
4
YANG is .
  • A NETCONF modeling language
  • Think SMI for NETCONF
  • Models semantics and data organization
  • Syntax falls out of semantics
  • Able to model config data, state data, RPCs, and
    notifications
  • Based on SMIng syntax
  • Text-based
  • Email, patch, and RFC friendly

5
YANG Concepts
Standard Models
Proprietary Models
config data
RPCs
notifications
  • containers

leafs
types
6
YANG ....
  • Directly maps to XML content (on the wire)
  • Extensible
  • Add new content to existing data models
  • Without changing the original model
  • Add new statements to the YANG language
  • Vendor extensions and future proofing
  • Preserves investment in SNMP MIBs
  • libsmi translates MIBs to YANG
  • See tools at www.yang-central.org

7
Semantics and syntax
Semantic World
YANG
Syntactic World
Relax-NG
XML Schema
Anything Else
Out going XML
Legacy tools
Validation
8
YANG values ....
  • Readers and reviewers time and learning curve
  • Readability is highest priority
  • Limited Scope
  • Doesn't boil the ocean
  • Maximize utility within that scope
  • Can be extended in the future
  • Experience gained by existing implementations
  • Based on four proprietary modeling languages
  • Years of experience within multiple vendors
  • Quality draft backed by running code

9
Modules and submodules
  • Header statements
  • yang-version, namespace, prefix
  • Linkage statement
  • import and include
  • Meta information
  • organization, contact
  • Revision history
  • revision

Mod1
Import
Mod2
Include
SubA
Include
SubX
SubY
SubZ
10
module acme-module namespace
"http//acme.example.com/module" prefix
acme import "yang-types" prefix
yang include "acme-system"
organization "ACME Inc." contact
joe_at_acme.example.com description "The module
for entities implementing the
ACME products" revision 2007-06-09
description "Initial revision."
11
The "leaf" Statement
  • A leaf has
  • one value
  • no children
  • one instance

YANG Example leaf host-name type string
mandatory true config true
description "Hostname for this system"
NETCONF XML Encoding lthost-namegtmy.example.comlt/
host-namegt
12
The "leaf-list" Statement
  • A leaf-list has
  • one value
  • no children
  • multiple instances

YANG Example leaf-list domain-search type
string ordered-by user description
"List of domain names to search"
NETCONF XML Encoding ltdomain-searchgthigh.example
.comlt/domain-searchgt ltdomain-searchgtlow.example.co
mlt/domain-searchgt ltdomain-searchgteverywhere.exampl
e.comlt/domain-searchgt
13
The "container" Statement
  • A container has
  • no value
  • holds related children
  • one instance

YANG Example container system container
services container ssh
presence "Enables SSH" description
"SSH service specific configuration"
// more leafs, containers and stuff here...
  • May have specific meaning (presence)
  • Or may simply contain other nodes

NETCONF XML Encoding ltsystemgt ltservicesgt
ltssh/gt lt/servicesgt lt/systemgt
14
The "must" Statement
  • Constrains nodes by XPath expression

container timeout leaf access-timeout
description "Maximum time without server
response" units seconds
mandatory true type uint32
leaf retry-timer description "Period to
retry operation" units seconds
type uint32 must "this lt
../access-timeout" error-app-tag
retry-timer-invalid error-message
"The retry timer must be "
"less than the access timeout"

15
The "list" Statement
  • A list is
  • uniquely identified by key(s)
  • holds related children
  • no value
  • multiple instances

YANG Example list user key name leaf
name type string leaf uid
type uint32 leaf full-name
type string leaf class
type string default viewer
NETCONF XML Encoding ltusergt
ltnamegtglockslt/namegt ltfull-namegtGoldielt/full-name
gt ltclassgtintruderlt/classgt lt/usergt ltusergt
ltnamegtsnoweylt/namegt ltfull-namegtSnowlt/full-namegt
ltclassgtfree-loaderlt/classgt lt/usergt ltusergt
ltnamegtrzulllt/namegt ltfull-namegtRepunlt/full-namegt
lt/usergt
16
The "augment" Statement
  • Extends data model
  • Current or imported modules
  • Inserts nodes
  • Into an existing hierarchy
  • Nodes appear in current module's namespace
  • Original (augmented) module is unchanged

YANG Example augment system/login/user
leaf expire type yangdate-and-time

NETCONF XML Encoding ltusergt
ltnamegtalicewlt/namegt ltclassgtdrop-outlt/classgt
ltotherexpiregt2112-04-01T120000lt/otherexpiregt lt
/usergt
17
The "when" Statement
YANG Example augment system/login/user
when "class wheel" leaf shell
type string
  • Makes sparse augmentation
  • Nodes are only added when condition is true
  • "when" is XPath expression

NETCONF XML Encoding ltusergt
ltnamegtalicewlt/namegt ltclassgtwheellt/classgt
ltothershellgt/bin/tcshlt/othershellgt lt/usergt
18
Built-in types
19
Derived types
YANG Example typedef percent type uint16
range "0 .. 100" description
"Percentage" leaf completed type
percent
  • Constraints
  • range
  • length
  • pattern
  • regex
  • A modules may use types imported from other
    modules

NETCONF XML Encoding ltcompletedgt20lt/completedgt
20
The "union" type
  • Allows a leaf to contain a superset of types

YANG Example leaf limit description
"Number to allow" type union type
uint16 range "0 .. 100"
type enumeration enum none
description "No limit"

NETCONF XML Encoding ltlimitgtnonelt/limitgt
NETCONF XML Encoding ltlimitgt20lt/limitgt
21
The "grouping" Statement
  • Defines a reusable collection of nodes
  • Use multiple times
  • A modules may use groupings imported from other
    modules
  • Refinement
  • Use as structure, record, or object

YANG Example grouping target leaf address
type inetip-address
description "Target IP address" leaf
port type inetip-port
description "Target port number"
container peer container destination
uses target
NETCONF XML Encoding ltpeergt ltdestinationgt
ltaddressgt192.0.2.1lt/addressgt ltportgt22lt/portgt
lt/destinationgt lt/peergt
22
The "choice" Statement
  • Allow only one member of the choice to exist in a
    valid config datastore

YANG Example choice transfer-method leaf
transfer-interval description
"Frequency at which file transfer happens"
type uint range "15 .. 2880"
units minutes leaf
transfer-on-commit description
"Transfer after each commit" type
empty
NETCONF XML Encoding lttransfer-on-commit/gt
23
The "anyxml" Statement
  • Allows arbitrary XML content to be carried in
    YANG-based models
  • Opaque
  • Limited operations
  • Bulk only

YANG Example anyxml software-version
description "Number to allow"
NETCONF XML Encoding ltsoftware-versiongt
ltbasegtA10.2lt/basegt ltroutinggtB4.2lt/routinggt
ltsnmpgtC87.12lt/snmpgt lt/software-versiongt
24
The "rpc" Statement
rpc activate-software-image input
leaf image-name type string
output leaf status
type string
  • Defines RPC
  • method names
  • input parameters
  • output parameters

ltrpc xmlns"urnmumble"gt ltactivate-software-imag
egt ltimage-namegtimage.tgzlt/image-namegt
lt/activate-software-imagegt lt/rpcgt
25
The "notification" Statement
  • Defines notification
  • Name
  • Content

YANG Example notification link-failure
description "A link failure has been detected"
leaf if-index type int32 range "1
.. max" leaf if-name type
keyref path "/interfaces/interface/n
ame"
26
Semantic Differentiators
  • Notice that YANG is modeling the semantics and
    data organization
  • Not just the syntax

27
Tools (yang-central.org)
  • pyang (python)
  • Validates YANG
  • Translates between YANG and YIN (XML)
  • Generates XSD
  • yangto (binary)
  • Validates YANG
  • Generates XSD, dependencies, etc
  • libsmi
  • Translates SMI/SMIv2 MIBs to YANG
  • Other goodies
  • Emacs mode

28
What can you do to help?
  • Read the draft
  • There's a lot more in there
  • Join the mailing list
  • yang_at_ietf.org
  • https//www.ietf.org/mailman/listinfo/yang
  • Try out the tools
  • www.yang-central.org
  • Tutorial (this) at
  • http//www.yang-central.org/twiki/bin/view/Main/Ya
    ngTutorials
Write a Comment
User Comments (0)
About PowerShow.com