Instant YANG. The Basics. Hakan Millroth, Tail- f Systems (email: hakan@tail- f.com)



Similar documents
Information Models, Data Models, and YANG. IETF 86, Orlando,

OpenFlow Configuration and Management Protocol OF-CONFIG 1.0

TAIL-F SYSTEMS TECHNOLOGY BRIEF Creating and modifying network services using Tail-f NCS

Tutorial: NETCONF and YANG

NAT TCP SIP ALG Support

Working with YANG Data Models and Instances Using (Mainly) pyang

Tail-f White Paper. Configuration Management Simplified. Executive summary. Why NETCONF and YANG?

Configuring Timeout, Retransmission, and Key Values Per RADIUS Server

3GPP TS V8.1.0 ( )

P. van der Stok. Intended status: Standards Track Expires: April 18, J. Schoenwaelder Jacobs University A. Sehgal. consultant.

Simple Network Management Protocol

Supported Platforms. Supported Standards, MIBs, and RFCs. Prerequisites. Related Features and Technologies. Related Documents. Improved Server Access

Working With Virtual Hosts on Pramati Server

Cryoserver Archive Lotus Notes Configuration

[MS-SPEMAWS]: SharePoint Web Service Protocol. Intellectual Property Rights Notice for Open Specifications Documentation

A Guide to NETCONF for SNMP Developers

Configuring the Cisco ISA500 for Active Directory/LDAP and RADIUS Authentication

Web Services for Management Perl Library VMware ESX Server 3.5, VMware ESX Server 3i version 3.5, and VMware VirtualCenter 2.5

Chapter 3 Configuring Basic IPv6 Connectivity

DHCP and DNS Protocols

Secure Messaging Server Console... 2

Configuring CSS Remote Access Methods

Network Configuration Management with NETCONF and YANG. 84th IETF Meeting, Vancouver,

NetFlow v9 Export Format

Setup Guide Central Monitoring of SAP NetWeaver Proces Integration 7.3 with SAP Solution Manager 7.1. Active Global Support February 2011

ETSI TS V8.4.0 ( )

HTTP 1.1 Web Server and Client

Web Server Manual. Mike Burns Greg Pettyjohn Jay McCarthy November 20, 2006

[MS-MDM]: Mobile Device Management Protocol. Intellectual Property Rights Notice for Open Specifications Documentation

Using YANG for the Dissemination of the Traffic Engineering Database within Software Defined Elastic Optical Networks

HP Load Balancing Module

This means that any user from the testing domain can now logon to Cognos 8 (and therefore Controller 8 etc.).

Aculab digital network access cards

Websense Web Security Gateway: Integrating the Content Gateway component with Third Party Data Loss Prevention Applications

Introduction to IP v6

Network Layers. CSC358 - Introduction to Computer Networks

Pcounter Web Administrator User Guide - v Pcounter Web Administrator User Guide Version 1.0

Easy configuration of NETCONF devices

Authoring for System Center 2012 Operations Manager

PVFS High Availability Clustering using Heartbeat 2.0

Configuring SSL Termination

NAST. Documentation. Copyright 2013 DENIC eg. Doc. version: 1.9 Doc. status: Final

Network Configuration Management Using NETCONF and YANG

Private to Public Overflow between IP Media Gateways

Configuring NetFlow Secure Event Logging (NSEL)

LUCOM GmbH * Ansbacher Str. 2a * Zirndorf * Tel / * Fax / *

Card Commands on page 795 MDA Commands on page 796 Threat Management Service Interface Commands on page 797 Policy Commands on page 801

BGP: Border Gateway Protocol

MICROSOFT EXAM QUESTIONS & ANSWERS MICROSOFT EXAM QUESTIONS & ANSWERS

Configuring Single Sign-on for WebVPN

SCOPTEL WITH ACTIVE DIRECTORY USER DOCUMENTATION

DHCP and DNS Services

NSi Mobile Installation Guide. Version 6.2

Firewall Builder Architecture Overview

SNMPc Release 7.0 Disaster Recovery Support. Castle Rock Computing March, 2004

Contents About the Contract Management Post Installation Administrator's Guide... 5 Viewing and Modifying Contract Management Settings...

Visual Basic. murach's TRAINING & REFERENCE

Cleo Communications. CUEScript Training

Business Object Document (BOD) Message Architecture for OAGIS Release 9.+

SOFTWARE DEFINED NETWORKS REALITY CHECK. DENOG5, Darmstadt, 14/11/2013 Carsten Michel

Configuring Simple Network Management Protocol (SNMP)

How To Install Hoteltv2 On A Pc Or Mac Or Mac (For Mac)

2. What is the maximum value of each octet in an IP address? A. 28 B. 255 C. 256 D. None of the above

McAfee Network Threat Response (NTR) 4.0

FileCruiser Backup & Restoring Guide

BEA WebLogic Server. and BEA WebLogic Express. SNMP Management Guide

Integrating Avaya Aura Presence Services with Microsoft OCS

Move a VM 3.0 with AD Integration to a new server. Creation date: 17/06/2008 Last Review: 26/06/2008 Revision number: 1

NetFlow Aggregation. Feature Overview. Aggregation Cache Schemes

Chapter 8 The Enhanced Entity- Relationship (EER) Model

EVALUATION. WA1844 WebSphere Process Server 7.0 Programming Using WebSphere Integration COPY. Developer

Security Provider Integration LDAP Server

How to add your Weebly website to a TotalCloud hosted Server

Abstract. Avaya Solution & Interoperability Test Lab

Network Address Translation Commands

IPv6 Diagnostic and Troubleshooting

Web Service Reference

IPedge Feature Desc. 5/25/12

This presentation discusses the new support for the session initiation protocol in WebSphere Application Server V6.1.

Configuring SNMP and using the NetFlow MIB to Monitor NetFlow Data

[MS-BDSRR]: Business Document Scanning: Scan Repository Capabilities and Status Retrieval Protocol

Application. Transport. Network. Data Link. Physical. Network Layers. Goal

Document version: 1.3 What's inside: Products and versions tested Important:

1. Configuring the Dispatcher / Load Balancer

Remote Management. Vyatta System. REFERENCE GUIDE SSH Telnet Web GUI Access SNMP VYATTA, INC.

Enabling Remote Access to the ACE

IBM DB2 XML support. How to Configure the IBM DB2 Support in oxygen

SNMP Simple Network Management Protocol

Simple Network Management Protocol

ENUM. Patrik Fältström

RingMaster Software Version 7.6 Web Services API User Guide

Contents. 2 Alfresco API Version 1.0

Configuring Logging. Information About Logging CHAPTER

DHCP Server Port-Based Address Allocation

Sample Configuration for SIP Trunking between Avaya IP Office R8.0 and Cisco Unified Communications Manager Issue 1.0

Introduction to Service Oriented Architectures (SOA)

Transcription:

Instant YANG Hakan Millroth, Tail- f Systems (email: hakan@tail- f.com) This is a short primer on the NETCONF data modeling language YANG. To learn more about YANG, take a look at the tutorials and examples at YANG Central. The definite resource is RFC 6020, which is an excellent and quite readable reference manual. If you wonder why NETCONF needs a data modeling language, check out the "Why YANG?" document at YANG Central. The Basics A data model describes how data is represented and accessed. In YANG, data models are represented by definition hierarchies called schema trees. Instances of schema trees are called data trees and are encoded in XML. YANG provides two constructs to specify leaf nodes: leaf and leaf- list statements. They differ in that a leaf node has at most one instance, while a leaf- list node may have multiple instances. This YANG snippet specifies a flag called enabled that defaults to true: leaf enabled { type boolean; default true; Example XML instance: <enabled>false</enabled> The following YANG example specifies a list of cipher names:

leaf-list cipher { Example XML instance: <cipher>blowfish-cbc</cipher> <cipher>3des-cbc</cipher> The number of valid entries in a leaf- list can be constrained by optional minelements and max-elements statements. There are also two constructs in YANG for specifying non- leaf nodes: container and list statements. They differ mainly in that a container node has at most one instance, while a list node may have multiple instances (list entries are identified by keys that distinguish them from each other). The following YANG example uses a container statement to define a timeout mechanism for a request to a server. The timeout has two components: accesstimeout, which represents the maximum time without server response, and retries, which represents the number of request attempts before giving up. container timeout { leaf access-timeout { type uint32; leaf retries { type uint8; Example XML instance: <timeout> <access-timeout>60</access-timeout> <retries>2</retries> </timeout>

The next example illustrates YANG lists. The entries in a list are identified by keys that distinguish them from each other. Here computer users are identified with their login name: list user { key "login-name"; leaf login-name { leaf full-name { Example XML instances: <user> <login-name>hakanm</login-name> <full-name>hakan Millroth</fullname> </user> <user> <login-name>mbj</login-name> <full-name>martin Bjorklund</fullname> </user> The examples so far have only used built- in YANG types. The set of built- in types are similar to those of many programming languages, but with some differences due to special requirements from the management domain. YANG also provides a mechanism through which additional types may be defined (these are called derived types). For example, the following defines a type percent that is a restriction of the built- in type uint8: typedef percent { type uint8 { range "0.. 100";

The next example defines the type ip-address as the union of two other derived types (union is a built- in type): typedef ip-address { type union { type ipv4-address; type ipv6-address; More Data Structuring Features A choice node in the schema tree defines a set of alternatives, only one of which may exist at any one time. A choice consists of a number of branches, defined with case substatements. The nodes from at most one of the choice s branches exist in the data tree (the choice node itself does not exist in the data tree). Example: choice route-distinguisher { case ip-address-based { leaf ip-address { type ipv4-address; leaf ip-address-number { type uint16; case asn32-based { leaf asn32 { type uint32; leaf two-byte-number { type uint16;

Example XML instantiation: <asn32>12356789</asn32> <two-byte-number>2468</two-byte-number> A grouping defines a reusable collection of nodes. Here we define a grouping endpoint comprising two leaf nodes: grouping endpoint { leaf address { type ip-address; leaf port { type port-number; The uses statement is used to reference a grouping definition, copying the nodes defined by the grouping into the current schema tree. Continuing the example, we can reuse the endpoint grouping in defining the source and destination of a connection: container connection { container source { uses endpoint { refine port { default 161;

container destination { uses endpoint { refine port { default 161; Here we have used the (optional) refine statement. Example XML instance: <connection> <source> <address>192.168.0.3</address> <port>8080</port> </source> <destination> <address>192.168.0.4</address> <port>8080</port> </destination> </connection> The presence statement gives semantics to the existence of a container in the data tree (normally a container is just a data structuring mechanism). It takes as an argument a documentation string that describes what the model designer intend the node s presence to signify: container logging { presence "Enables logging"; leaf directory { default "/var/log/myapplication"; An alternative to using presence is to define a leaf (called, for example, enabled or disabled or on or off) conveying the presence of the container.

References The leafref built- in type is used to reference a particular leaf instance in the data tree, as specified by a path. This path is specified using the XML Path Language (XPath), in a notation that is similar to the syntax for directory paths in Unix/Linux. Consider this example: leaf interface-name { type leafref { path "/interface/name"; Here interface-name is referencing another leaf using an absolute path. The next example instead lets interface-name reference a leaf using a relative path: leaf interface-name { type leafref { path "../interface/name"; There is an analogous referencing construct for list keys called keyref. Data Constraints YANG supports several types of constraints that express semantic properties of the data being modeled. Data nodes can represent either configuration data or state data. The config statement specifies whether the definition it occurs in represent configuration data (config=true) or status data (config=false). If config is not specified, the default is the same as the parent schema node s config value. If the top node does not specify a config statement, the default is config=true.

YANG provides a mandatory statement to express that a node must exist in the data tree (it is also possible to have optional nodes). The following example shows the use of config and mandatory: leaf host-name { mandatory true; config true; The unique statement ensures unique values within list siblings. Here is an example of its use (note that the constraint specifies that the combination of two leaf values, ip and port, must be unique): list server { key "name"; unique "ip port"; leaf name { leaf ip { type ip-address; leaf port { type port-number; The must statement expresses constraints that must be satisfied by each data node in the structure where it is defined. The must constraints are expressed using XPath expressions. The following examples models an IP address that does not belong to the 192.* or 127.* networks:

leaf mirrorip { type ip-address; default 0.0.0.0; must "false() = starts-with(current(), '192')" { error-message "The mirrorip is in the forbidden "+ "192.* network"; must "false() = starts-with(current(), '127')" { error-message "The mirrorip is in the occupied "+ "127.* network"; Modules YANG organizes data models into modules and submodules. A module can import data from other modules, and include data from submodules. Besides schema definitions, a module contains header statements (yang- version, namespace, prefix), linkage statements (import and include), meta information (organization, contact), and a revision history. All nodes defined in a module belong to a specified XML namespace, which is specified by the URI of the namespace. It is good practice to have a one- to- one correspondence between modules and namespaces. If an import or include statement includes a revision-date substatement, definitions are taken from the specified revision of the imported or included module. By importing specified module revisions one can allow published modules to evolve independently over time. YANG provides very specific rules for how published modules can evolve over time and still be backwards compatible (to oversimplify, it is possible to add new definitions, but not to delete obsolete definitions or change already published definitions). Here is an example of a module definition:

module acme-module { namespace "http://acme.example.com/module"; prefix acme; import "yang-types" { prefix yang; include "acme-system"; organization "ACME Inc."; contact joe@acme.example.com; description "The module for entities implementing the ACME products"; revision 2007-06-09 { description "Initial revision.";... The module hierarchy can be augmented, allowing one module to add data nodes to the hierarchy defined in another module (without changing the augmented module). Augmentation can be conditional, using when statements, with new nodes appearing only if certain conditions are met. In the following example we (unconditionally) augment a generic router module to a data model for a RIP routing stack:

module rip_router { import router { prefix r; augment "/r:system/r:router" { container rip { leaf version {... list network-ip {... list network-ifname {... list neighbor {...... Note that the import statement assigns the prefix r to the imported module router. When we then reference identifiers from that module we must use the prefix, as in /r:system/r:router. This example also illustrates a common YANG design pattern with a top- level container (rip in this case). RPCs and Notifications YANG allows the definition of NETCONF RPCs, extending the base set of operations provided by the NETCONF standard. Input and output parameters are modeled using YANG data definition statements. In the following example we model a new RPC for activating software images:

rpc activate-software-image { input { leaf image-name { output { leaf status { YANG data definition statements can also be used to model the names and content of NETCONF notifications. Here is an example where we reuse the definition of a connection from above: notification link-failure { description "A link failure has been detected"; container link { uses connection This example also illustrates the use of description statement. All YANG data definition statements (leaf, list, leaf-list, etc) can include description statements. Acknowledgement This paper was inspired by Hetland s Instant Python text. Many of the examples, and some verbatim text, are from the YANG specification (RFC 6020). Some material are from various IETF tutorials by Martin Björklund and Jürgen Schönwälder. Some examples are from Tail- f Systems product documentation.