YANG HighLevel Presentation YIN XML on the wire · YANG HighLevel Presentation YIN XML on the wire...
Transcript of YANG HighLevel Presentation YIN XML on the wire · YANG HighLevel Presentation YIN XML on the wire...
![Page 1: YANG HighLevel Presentation YIN XML on the wire · YANG HighLevel Presentation YIN XML on the wire IETF 72 Martin Björklund mbj@tailf.com](https://reader034.fdocuments.net/reader034/viewer/2022051601/5ae10fcd7f8b9a595d8b6105/html5/thumbnails/1.jpg)
YANG HighLevel PresentationYIN
XML on the wire
IETF 72Martin Björklundmbj@tailf.com
![Page 2: YANG HighLevel Presentation YIN XML on the wire · YANG HighLevel Presentation YIN XML on the wire IETF 72 Martin Björklund mbj@tailf.com](https://reader034.fdocuments.net/reader034/viewer/2022051601/5ae10fcd7f8b9a595d8b6105/html5/thumbnails/2.jpg)
2
YANG HighLevel
● YANG data models are written in YANG modules
– Header statements● namespace, prefix
– Linkage statements● import, include
– Meta statements● organization, contact,● description, reference
– Revision history● revision
SubX SubY SubZ
SubA
Mod1
Mod2
Include
Import
Include
![Page 3: YANG HighLevel Presentation YIN XML on the wire · YANG HighLevel Presentation YIN XML on the wire IETF 72 Martin Björklund mbj@tailf.com](https://reader034.fdocuments.net/reader034/viewer/2022051601/5ae10fcd7f8b9a595d8b6105/html5/thumbnails/3.jpg)
3
YANG Concepts
leafs
config data
types
RPCs notifications
Standard Models
Proprietary Models
containers
state data
![Page 4: YANG HighLevel Presentation YIN XML on the wire · YANG HighLevel Presentation YIN XML on the wire IETF 72 Martin Björklund mbj@tailf.com](https://reader034.fdocuments.net/reader034/viewer/2022051601/5ae10fcd7f8b9a595d8b6105/html5/thumbnails/4.jpg)
4
YANG module
● reusable simple type definitions (typedefs)
● reusable groups of nodes (groupings)
● data definitions (configuration and state data)
● operations (rpcs)
● notifications
● extensions to other modules
![Page 5: YANG HighLevel Presentation YIN XML on the wire · YANG HighLevel Presentation YIN XML on the wire IETF 72 Martin Björklund mbj@tailf.com](https://reader034.fdocuments.net/reader034/viewer/2022051601/5ae10fcd7f8b9a595d8b6105/html5/thumbnails/5.jpg)
5
Data definitions
● Structure
– container, list, leaflist, leaf
● Syntax
– type
● Semantics
● Integrity constraints
– YANG allows to formally specify integrity constraints on configuration data. These constraints are enforced by the server.
● Relationships
![Page 6: YANG HighLevel Presentation YIN XML on the wire · YANG HighLevel Presentation YIN XML on the wire IETF 72 Martin Björklund mbj@tailf.com](https://reader034.fdocuments.net/reader034/viewer/2022051601/5ae10fcd7f8b9a595d8b6105/html5/thumbnails/6.jpg)
6
Structure 1(3)
● container
– Used to group related nodes in a subtree. It has no data value, only child nodes.
– Can be purely organizational or carry some semantic meaning by its presence in the configuration data store.
● leaf
– A leaf node has a value and no children.– Can have a default.– Can be mandatory or optional.container server { container address { leaf ip { type inet:ip-address; } leaf port { type inet:port-number; } }}
![Page 7: YANG HighLevel Presentation YIN XML on the wire · YANG HighLevel Presentation YIN XML on the wire IETF 72 Martin Björklund mbj@tailf.com](https://reader034.fdocuments.net/reader034/viewer/2022051601/5ae10fcd7f8b9a595d8b6105/html5/thumbnails/7.jpg)
7
Structure 2(3)
● list
– Used to define a sequence of list entries, where each list entry contains any number of child nodes of any type, including other lists.
– A list entry is uniquely identified by the value of its key(s).– The order of the entries can carry semantic meaning (e.g.
firewall filter rules)
list user { key login-name; leaf login-name { type string; } leaf full-name { type string; }}
![Page 8: YANG HighLevel Presentation YIN XML on the wire · YANG HighLevel Presentation YIN XML on the wire IETF 72 Martin Björklund mbj@tailf.com](https://reader034.fdocuments.net/reader034/viewer/2022051601/5ae10fcd7f8b9a595d8b6105/html5/thumbnails/8.jpg)
8
Structure 3(3)
● leaflist
– Used to define a sequence of simple values.– The order of the entries can carry semantic meaning (e.g.
dns server list)– A leaflist entry is uniquely identified by its value.
![Page 9: YANG HighLevel Presentation YIN XML on the wire · YANG HighLevel Presentation YIN XML on the wire IETF 72 Martin Björklund mbj@tailf.com](https://reader034.fdocuments.net/reader034/viewer/2022051601/5ae10fcd7f8b9a595d8b6105/html5/thumbnails/9.jpg)
9
Reusable simple types
typedef defines a named type which can be reused in the same module or in other modules. The new type is derived from some existing type – builtin or derived.
typedef port-number { type uint16 { range "1..65535"; } ...}
![Page 10: YANG HighLevel Presentation YIN XML on the wire · YANG HighLevel Presentation YIN XML on the wire IETF 72 Martin Björklund mbj@tailf.com](https://reader034.fdocuments.net/reader034/viewer/2022051601/5ae10fcd7f8b9a595d8b6105/html5/thumbnails/10.jpg)
10
Reusable groups of nodes
grouping address-type { description "A reusable address group.";
leaf ip { type inet:ip-address; } leaf port { type inet:port-number; }}
container server { container address { uses address-type; }}
grouping defines a named group of related nodes. The grouping can be reused in the same or other modules.
![Page 11: YANG HighLevel Presentation YIN XML on the wire · YANG HighLevel Presentation YIN XML on the wire IETF 72 Martin Björklund mbj@tailf.com](https://reader034.fdocuments.net/reader034/viewer/2022051601/5ae10fcd7f8b9a595d8b6105/html5/thumbnails/11.jpg)
11
Operations
The rpc statement defines a new operation
– operation name– input parameters– output parameters
An operation can reference data in the data model, e.g. an operation which restarts an interface can be defined.
rpc restart-interface { input { leaf interface-name { ... } }}
![Page 12: YANG HighLevel Presentation YIN XML on the wire · YANG HighLevel Presentation YIN XML on the wire IETF 72 Martin Björklund mbj@tailf.com](https://reader034.fdocuments.net/reader034/viewer/2022051601/5ae10fcd7f8b9a595d8b6105/html5/thumbnails/12.jpg)
12
Extensions to other modules
It is anticipated that vendors will need to add vendorspecific configuration data to standard data models. This must be done without breaking applications that only understand the standard data models.
YANG provides the augment statement, which is used to insert nodes into another data model. The augmentation can be conditional, so that the nodes are only inserted when a certain condition is met (e.g. some nodes are only added to interfaces of a specific type).
![Page 13: YANG HighLevel Presentation YIN XML on the wire · YANG HighLevel Presentation YIN XML on the wire IETF 72 Martin Björklund mbj@tailf.com](https://reader034.fdocuments.net/reader034/viewer/2022051601/5ae10fcd7f8b9a595d8b6105/html5/thumbnails/13.jpg)
13
YIN● YANG is designed with a simple, regular syntax, optimized for humans to read and write.
● YIN is a semantically equivalent syntax in XML
– YANG(YIN(M)) == M– design goal: as readable as possible
● The XML syntax is useful for using XML tools such as XSLT for things like:
– extract text for documentation– generate code– transform into other forms– display in / generate from graphical XML tools– ...
![Page 14: YANG HighLevel Presentation YIN XML on the wire · YANG HighLevel Presentation YIN XML on the wire IETF 72 Martin Björklund mbj@tailf.com](https://reader034.fdocuments.net/reader034/viewer/2022051601/5ae10fcd7f8b9a595d8b6105/html5/thumbnails/14.jpg)
14
YIN Mapping 1(3)YANG grammar:
statement = keyword [argument] (";" / "{" *statement "}")
YIN mapping rules:
● Each keyword is translated into an XML element.
● The optional argument is translated into an XML attribute or an XML element, depending on the keyword.
● Any substatements are translated into child elements.
![Page 15: YANG HighLevel Presentation YIN XML on the wire · YANG HighLevel Presentation YIN XML on the wire IETF 72 Martin Björklund mbj@tailf.com](https://reader034.fdocuments.net/reader034/viewer/2022051601/5ae10fcd7f8b9a595d8b6105/html5/thumbnails/15.jpg)
15
YIN Mapping 2(3)
Example:
leaf address { type inet:ip-address;}
<leaf name="address"> <type name="inet:ip-address"/></leaf>
![Page 16: YANG HighLevel Presentation YIN XML on the wire · YANG HighLevel Presentation YIN XML on the wire IETF 72 Martin Björklund mbj@tailf.com](https://reader034.fdocuments.net/reader034/viewer/2022051601/5ae10fcd7f8b9a595d8b6105/html5/thumbnails/16.jpg)
16
YIN Mapping 3(3)
When an extension is declared, the name of the extension's argument (if any) is specified, and whether the argument is mapped to an XML element or attribute in YIN.
module my-extensions { ... extension help { argument text { yin-element true; } }}
<container name=”interface”> <myext:help> <text>help msg</text> </myext:help></container>
module my-configs { ... import my-extensions { prefix myext; } container interface { myext:help “help msg”; }
![Page 17: YANG HighLevel Presentation YIN XML on the wire · YANG HighLevel Presentation YIN XML on the wire IETF 72 Martin Björklund mbj@tailf.com](https://reader034.fdocuments.net/reader034/viewer/2022051601/5ae10fcd7f8b9a595d8b6105/html5/thumbnails/17.jpg)
17
NETCONF XML mapping 1(4)
module my-config { namespace “http://example.com/my-config” container system { ... }}
<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <edit-config> <target> <running/> </target> <config> <system xmlns=”http://example.com/my-config”> ... </system> </config></rpc>
All nodes in a module are encoded as XML elements in the module's namespace:
![Page 18: YANG HighLevel Presentation YIN XML on the wire · YANG HighLevel Presentation YIN XML on the wire IETF 72 Martin Björklund mbj@tailf.com](https://reader034.fdocuments.net/reader034/viewer/2022051601/5ae10fcd7f8b9a595d8b6105/html5/thumbnails/18.jpg)
18
NETCONF XML Mapping 2(4)
● container
– XML element with no text, only XML sub elements.
● leaf
– XML element with text data, and no XML sub elements
● leaflist
– Each entry in the list is encoded as one XML element like a leaf.
– If the leaflist is orderedby user, then order MUST be preserved in the XML encoding.
– If the leaflist is orderedby system, then the entries can be encoded in any order.
![Page 19: YANG HighLevel Presentation YIN XML on the wire · YANG HighLevel Presentation YIN XML on the wire IETF 72 Martin Björklund mbj@tailf.com](https://reader034.fdocuments.net/reader034/viewer/2022051601/5ae10fcd7f8b9a595d8b6105/html5/thumbnails/19.jpg)
19
NETCONF XML Mapping 3(4)
● list
– Each entry in the list is encoded as one XML element like a container, containing each key as a sub element, followed by the rest of the list entry content as sub elements.
– If the list is orderedby user, then order MUST be preserved in the XML encoding.
– If the list is orderedby system, then the entries can be encoded in any order.
![Page 20: YANG HighLevel Presentation YIN XML on the wire · YANG HighLevel Presentation YIN XML on the wire IETF 72 Martin Björklund mbj@tailf.com](https://reader034.fdocuments.net/reader034/viewer/2022051601/5ae10fcd7f8b9a595d8b6105/html5/thumbnails/20.jpg)
20
NETCONF XML Mapping 4(4)
● Example of a list encoding:
list server { key name; leaf name { ... } leaf ip { ... } leaf port { ... }}
<server> <name>smtp</name> <ip>192.0.2.1</ip> <port>25</port></server><server> <name>http</name> <ip>192.0.2.1</ip> <port>25</port></server>
![Page 21: YANG HighLevel Presentation YIN XML on the wire · YANG HighLevel Presentation YIN XML on the wire IETF 72 Martin Björklund mbj@tailf.com](https://reader034.fdocuments.net/reader034/viewer/2022051601/5ae10fcd7f8b9a595d8b6105/html5/thumbnails/21.jpg)
21
Free YANG tools● libsmi (http://www.ibr.cs.tubs.de/projects/libsmi)
– generates YANG from SMIv2– open source
● pyang (http://code.google.com/p/pyang)
– YANG validator– translates between YANG and YIN– generates XSD and DSDL from YANG and YIN– open source
● yangdump (http://www.netconfcentral.org/download)
– YANG validator– generates XSD and HTML from YANG– free binary
![Page 22: YANG HighLevel Presentation YIN XML on the wire · YANG HighLevel Presentation YIN XML on the wire IETF 72 Martin Björklund mbj@tailf.com](https://reader034.fdocuments.net/reader034/viewer/2022051601/5ae10fcd7f8b9a595d8b6105/html5/thumbnails/22.jpg)
22
Things to work on
● Feedback from IPFIX YANG users:
– Need a mechanism to divide a module into optionaltoimplement parts. A client must be able to query the server which optional parts of a module it implements.
– Need a mechanism for a client to discover serverspecific variance (for example serverspecific limits on number of entries in lists).
● Rules for module revisioning
● Clarifications to the document (please review!)
● Several open issues to be discussed tomorrow