Presentation is loading. Please wait.

Presentation is loading. Please wait.

YANG Boot Camp The YANG Gang IETF 71 NETCONF Modeling Language NETCONF base protocol (rfc 4741) RPC mechanism and operations Left content and data models.

Similar presentations

Presentation on theme: "YANG Boot Camp The YANG Gang IETF 71 NETCONF Modeling Language NETCONF base protocol (rfc 4741) RPC mechanism and operations Left content and data models."— Presentation 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, and Mgmt Application YANG modules Devices

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 , patch, and RFC friendly

5 YANG Concepts leafs config data types RPCsnotifications Standard Models Proprietary Models containers

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

7 Semantics and syntax YANG Relax-NG XML Schema Anything Else Legacy tools Out going XML Semantic World Syntactic World 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 SubXSubYSubZ SubA Mod1 Mod2 Include Import Include

10 module acme-module { namespace ""; prefix acme; import "yang-types" { prefix yang; } include "acme-system"; organization "ACME Inc."; contact description "The module for entities implementing the ACME products"; revision { description "Initial revision."; } … }

11 The "leaf" Statement YANG Example: leaf host-name { type string; mandatory true; config true; description "Hostname for this system"; } A leaf has one value no children one instance NETCONF XML Encoding:

12 The "leaf-list" Statement YANG Example: leaf-list domain-search { type string; ordered-by user; description "List of domain names to search"; } A leaf-list has one value no children multiple instances NETCONF XML Encoding:

13 YANG Example: container system { container services { container ssh { presence "Enables SSH"; description "SSH service specific configuration"; // more leafs, containers and stuff here... } The "container" Statement A container has no value holds related children one instance NETCONF XML Encoding: May have specific meaning (presence) Or may simply contain other nodes

14 The "must" Statement 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 <../access-timeout" { error-app-tag retry-timer-invalid; error-message "The retry timer must be " + "less than the access timeout"; } Constrains nodes by XPath expression

15 The "list" Statement 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: glocks Goldie intruder snowey Snow free-loader rzull Repun A list is uniquely identified by key(s) holds related children no value multiple instances

16 The "augment" Statement YANG Example: augment system/login/user { leaf expire { type yang:date-and-time; } NETCONF XML Encoding: alicew drop-out T12:00:00 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

17 The "when" Statement YANG Example: augment system/login/user { when "class = wheel"; leaf shell { type string; } NETCONF XML Encoding: alicew wheel /bin/tcsh Makes sparse augmentation Nodes are only added when condition is true "when" is XPath expression

18 Built-in types CategoryTypes Integral{,u}int{8,16,32,64} Stringstring, enumeration, boolean Binary Databinary Bit fieldsbits Referencesinstance-identifier, keyref Otherempty

19 YANG Example: typedef percent { type uint16 { range " "; } description "Percentage"; } leaf completed { type percent; } Derived types NETCONF XML Encoding: 20 Constraints range length pattern regex A modules may use types imported from other modules

20 YANG Example: leaf limit { description "Number to allow"; type union { type uint16 { range " "; } type enumeration { enum none { description "No limit"; } The "union" type Allows a leaf to contain a superset of types NETCONF XML Encoding: 20 NETCONF XML Encoding: none

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 inet:ip-address; description "Target IP address"; } leaf port { type inet:ip-port; description "Target port number"; } container peer { container destination { uses target; } NETCONF XML Encoding:

22 YANG Example: choice transfer-method { leaf transfer-interval { description "Frequency at which file transfer happens"; type uint { range " "; } units minutes; } leaf transfer-on-commit { description "Transfer after each commit"; type empty; } The "choice" Statement Allow only one member of the choice to exist in a valid config datastore NETCONF XML Encoding:

23 YANG Example: anyxml software-version { description "Number to allow"; } The "anyxml" Statement Allows arbitrary XML content to be carried in YANG- based models Opaque Limited operations Bulk only NETCONF XML Encoding: A10.2 B4.2 C87.12

24 The "rpc" Statement Defines RPC method names input parameters output parameters rpc activate-software-image { input { leaf image-name { type string; } output { leaf status { type string; } image.tgz

25 The "notification" Statement 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/name"; } Defines notification Name Content

26 Semantic Differentiators Notice that YANG is modeling the semantics and data organization Not just the syntax StatementPurpose uniqueEnsure unique values within list siblings keyrefEnsure referential integrity configIndicate if a node is config data or not defaultSupply default value for leafs error-app-tagDefine the tag used when constraint fails error-messageDefine the message used.... mandatoryNode must exist in valid config datastore

27 Tools ( 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 Try out the tools Tutorial (this) at:

Download ppt "YANG Boot Camp The YANG Gang IETF 71 NETCONF Modeling Language NETCONF base protocol (rfc 4741) RPC mechanism and operations Left content and data models."

Similar presentations

Ads by Google