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



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

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

Easy configuration of NETCONF devices

NCClient: A Python Library for NETCONF Client Applications

OpenFlow Configuration and Management Protocol OF-CONFIG 1.0

Network Configuration Management Using NETCONF and YANG

Data Integration through XML/XSLT. Presenter: Xin Gu

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

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

LIME Base YANG Model Work Update draft-tissa-lime-yang-oam-model draft-wang-lime-yang-pm. Deepak Kumar Qin WU. IETF93 Prage,Czech

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

XSLT Mapping in SAP PI 7.1

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

Sage CRM Connector Tool White Paper

LabVIEW Internet Toolkit User Guide

Asterisk Module Documentation for the yencap Agent Release: ASTERISK-yencap-1.0.0

Specific Simple Network Management Tools

UML PROFILING AND DSL

YANG User Interface (YANGUI) in OpenDaylight

How To Create A Data Transformation And Data Visualization Tool In Java (Xslt) (Programming) (Data Visualization) (Business Process) (Code) (Powerpoint) (Scripting) (Xsv) (Mapper) (

Requirements Exchange: From Specification Documents to Models

What's new in 3.0 (XSLT/XPath/XQuery) (plus XML Schema 1.1) Michael Kay Saxonica

Introduction to XML Applications

VoIP Security Management

Cisco Networking Academy Program Curriculum Scope & Sequence. Fundamentals of UNIX version 2.0 (July, 2002)

Web Services Description Language (WSDL) Wanasanan Thongsongkrit

LDAP Server Configuration Example

XML Validation Guide. Questions or comments about this document should be directed to: E mail CEPI@michigan.gov Phone

8 Tutorial: Using ASN.1

IBM Operational Decision Manager Version 8 Release 5. Getting Started with Business Rules

TEST AUTOMATION FRAMEWORK

06 XML-based Technologies

Standard Registry Development and Publication Process

Understanding the SCSI MIB

Invitation to Ezhil : A Tamil Programming Language for Early Computer-Science Education 07/10/13

LDAP Server Configuration Example

XML Schema Definition Language (XSDL)

TNM093 Practical Data Visualization and Virtual Reality Laboratory Platform

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

TTCN-3, Qtronic and SIP

EMC Documentum Composer

BACKGROUND. Namespace Declaration and Qualification

Simple Network Management Protocol

System Behaviour Analysis with UML and Ptolemy. Scope and goals

XML for Manufacturing Systems Integration

25Live Configuration Utility

Data Tool Platform SQL Development Tools

Accessing Your Database with JMP 10 JMP Discovery Conference 2012 Brian Corcoran SAS Institute

CRM Global Search: Installation & Configuration

Oracle Data Integrator for Big Data. Alex Kotopoulis Senior Principal Product Manager

An Approach to Eliminate Semantic Heterogenity Using Ontologies in Enterprise Data Integeration

Alternatives to SNMP and Challenges in Management Protocols. Communication Systems Seminar Talk 10 Francesco Luminati

Remote Access API 2.0

How to Improve Database Connectivity With the Data Tools Platform. John Graham (Sybase Data Tooling) Brian Payton (IBM Information Management)

File management Editing X Window KDE. Debian/GNU Linux. Introduction II. Károly Erdei. November 21, Károly Erdei Debian/GNU Linux 1/45

A QUICK OVERVIEW OF THE OMNeT++ IDE

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

MDA Overview OMG. Enterprise Architect UML 2 Case Tool by Sparx Systems by Sparx Systems

FileMaker Server 10 Help

REDUCING THE COST OF GROUND SYSTEM DEVELOPMENT AND MISSION OPERATIONS USING AUTOMATED XML TECHNOLOGIES. Jesse Wright Jet Propulsion Laboratory,

Data Migration from Magento 1 to Magento 2 Including ParadoxLabs Authorize.Net CIM Plugin Last Updated Jan 4, 2016

What is Distributed Annotation System?

Smooks Dev Tools Reference Guide. Version: GA

Honors Class (Foundations of) Informatics. Tom Verhoeff. Department of Mathematics & Computer Science Software Engineering & Technology

Structured Data Capture (SDC) Trial Implementation

JobScheduler Web Services Executing JobScheduler commands

Advanced Guide for Configuring SNMPc to Manage Any SNMP Enabled Device

Whitepapers at Amikelive.com

TeamSite Templating Developer s Guide Release 5.5.1

CE 504 Computational Hydrology Computational Environments and Tools Fritz R. Fiedler

WA2087 Programming Java SOAP and REST Web Services - WebSphere 8.0 / RAD 8.0. Student Labs. Web Age Solutions Inc.

3GPP TS V8.1.0 ( )

WebSphere Business Monitor

Introduction to Ingeniux Forms Builder. 90 minute Course CMSFB-V6 P

Outline of the SNMP Framework

Agents and Web Services

EPNML an XML format for Petri nets

Evaluation of Nagios for Real-time Cloud Virtual Machine Monitoring

Guile Present. version 0.3.0, updated 21 September Andy Wingo

Developing Web Services with Eclipse

Firewall Builder Architecture Overview

Configuring SNMP Cisco and/or its affiliates. All rights reserved. 1

THE SNMP PROTOCOL THE SNMP REQUEST MIB SATELLAR 2DS/20DS SIMPLE NETWORK MANAGEMENT PROTOCOL SATELLAR MANAGEMENT WITH SNMP GET AND SET SMART RADIO

Managing XML Documents Versions and Upgrades with XSLT

How to Design and Create Your Own Custom Ext Rep

10CS73:Web Programming

Turing Machines, Part I

Visual Basic. murach's TRAINING & REFERENCE

Configuring the BIG-IP and Check Point VPN-1 /FireWall-1

HP OpenView Network Node Manager

PowerTier Web Development Tools 4

An XML Based Data Exchange Model for Power System Studies

Service for checking whether an is operative or not. Validate ids in your databases.

Transcription:

Working with YANG Data Models and Instances Using (Mainly) pyang Ladislav Lhotka lhotka@nic.cz 20 July 2014

Agenda Required software, Editing YANG modules, pyang plugins, Preparing a sample instance document, DSDL-based validation of instance documents, Converting XML instance documents to JSON. An extended version of this tutorial is available at https://code.google.com/p/pyang/wiki/tutorial 2

Required Software pyang https://code.google.com/p/pyang/ Libxml2 tools (xmllint, xsltproc). Packages available for most operating systems and distributions. http://www.xmlsoft.org/ Optional: Jing and Trang https://code.google.com/p/jing-trang/ GNU Emacs or Aquamacs 3

About pyang Command-line tool written in Python, XSLT and sh/bash. Extensible via plugins. Project site: https://code.google.com/p/pyang/ Under active development, new plugins and bugfixes only available in SVN. Last stable version: 1.4.1 (2013-11-11). RTFM: Unix man pages pyang (1) yang2dsdl (1) 4

Editing YANG Modules Commercial editors and development environments exist but standard editors mostly suffice. Special support for popular editors: http://www.yang-central.org/twiki/bin/view/main/yangtools Emacs yang-mode Vim syntax file With Emacs and nxml mode, it is also quite effective to use YIN syntax as the source format, see https://gitlab.labs.nic.cz/labs/yang-tools/wikis/editing_yang 5

Turing Machine Control unit Read-write head Tape YANG module: turing-machine.yang 6

Checking Module Correctness $ pyang turing-machine.yang Validation according to RFC 6087 rules: $ pyang --ietf turing-machine.yang 7

Plugins Conversions to various formats, activated with -f. Most plugins have specific command-line switches and arguments. yin, yang YIN and YANG syntax dsdl DSDL hybrid schema (RFC 6110) xsd W3C XML Schema (incomplete, deprecated) tree schema tree (ASCII art) xmi, uml UML diagrams jstree HTML/JavaScript YANG browser hypertree Hyperbolic YANG browser, to be used with Treebolic jsonxsl, jtox XML JSON instance document conversion sample-skeleton skeleton of a sample instance document 8

TM Schema Tree $ pyang -f tree turing-machine.yang Help on tree symbols: $ pyang --tree-help 9

state data configuration RPC notification module: turing-machine +--rw turing-machine +--ro state +--ro head-position +--ro tape +--ro cell* [coord] +--ro coord cell-index +--ro symbol? tape-symbol +--rw transition-function +--rw delta* [label] state-index cell-index +--rw label string +--rw input +--rw state state-index +--rw symbol tape-symbol +--rw output +--rw state? +--rw symbol? +--rw head-move? rpcs: +---x initialize +--ro input +--ro tape-content? string +---x run notifications: +---n halted +--ro state state-index state-index tape-symbol head-dir leaf type list key optional node 10

UML Diagram $ pyang -f uml -o tm.uml turing-machine.yang \ > --uml-no=stereotypes,annotation,typedef Conversion to PNG: $ plantuml tm.uml 11

12

DSDL Schemas DSDL = Document Schema Definition Languages International Standard ISO/IEC 19757, see http://dsdl.org. RFC 6110 defines the mapping of YANG data models to three schemas of the DSDL family: RELAX NG schema (grammar) and types Schematron semantic constraints DSRL (Document Schema Renaming Language) defaults $ yang2dsdl -t config turing-machine.yang == Generating RELAX NG schema './turing-machine-config.rng' Done. == Generating Schematron schema './turing-machine-config.sch' Done. == Generating DSRL schema './turing-machine-config.dsrl' Done. 13

Target for DSDL Schemas DSDL schemas can be generated for different target document types selected by the -t option: data configuration&state data, encapsulated in <nc:data> (default). config configuration data, encapsulated in <nc:config> get-reply complete reply to NETCONF get operation, get-config-reply reply to get-config operation, edit-config edit-config message, rpc RPC request defined in the data model, rpc-reply RPC reply defined in the data model, notification event notification defined in the data model. 14

Preparing Sample XML Instance Document In an I-D describing a data model, it is often useful to include a sample document showing instance data such as the contents of a configuration datastore. 1. Generate a skeleton document: $ pyang -f sample-skeleton turing-machine.yang \ > --sample-skeleton-annotations --sample-skeleton-doctype=config \ > xmllint -o turing-machine-config.xml --format - e skeleton document has to be edited! 2. Convert the RELAX NG schema to the compact syntax: $ trang -I rng -O rnc turing-machine-config.rng turing-machine-config.rnc 3. Load turing-machine-config.xml into Emacs. 15

Schema-based Validation use pre-generated schemas use jing schema name base XML instance to validate $ yang2dsdl -s -j -t config -b turing-machine -v turing-machine-config.xml == Using pre-generated schemas == Validating grammar and datatypes... turing-machine-config.xml validates. == Adding default values... done. == Validating semantic constraints... No errors found. Without -j, xmllint is used by default for RELAX NG validation it works, too, but often gives inferior/wrong error messages. 16

DSDL Validation Procedure grammar, data types XML document RELAX NG schema DSRL schema filling in defaults XML document with defaults semantic constraints Schematron schema 17

Converting XML Instances to JSON XML JSON mapping is defined in draft-ietf-netmod-yang-json-00. JSON is optional media type in RESTCONF: http://tools.ietf.org/html/draft-ietf-netconf-restconf-01 1. Generate XSLT 1.0 stylesheet with jsonxsl plugin: $ pyang -f jsonxsl -o tmjson.xsl turing-machine.yang 2. Apply the stylesheet to a valid XML instance document: $ xsltproc tmjson.xsl turing-machine-config.xml e same stylesheets works for all document types. e jtox plugin performs the opposite conversion. 18

Further Information 1. NETMOD WG: http://datatracker.ietf.org/wg/netmod/documents/ 2. NETCONF Central http://www.netconfcentral.org/ 3. pyang wiki https://code.google.com/p/pyang/w/list 4. YANG Central http://www.yang-central.org/twiki/bin/view/main/webhome 19