SlideShare a Scribd company logo
1 of 31
YANG Tutorial – part 2
Presented by Tail-f
MAY 27, 2013 2©2013 TAIL-F all rights reserved
TUTORIAL: NETCONF AND YANG
Advanced YANG Statements
MAY 27, 2013 3©2013 TAIL-F all rights reserved
TUTORIAL: NETCONF AND YANG
Must Statement
Restricts valid values by Xpath 1.0 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 ”current() < ../access-timeout" {
error-app-tag retry-timer-invalid;
error-message "The retry timer must be "
+ "less than the access timeout";
}
}
}
MAY 27, 2013 4©2013 TAIL-F all rights reserved
TUTORIAL: NETCONF AND YANG
Must Statement
leaf interface-group-name {
type string {
length "1..31";
pattern "[a-zA-Z][a-zA-Z0-9_-]*";
}
must "not(/sys:sys/interface[name = current()])" {
error-message ”Must be different from all interface names";
tailf:dependency "/sys:sys/interface/name";
}
}
MAY 27, 2013 5©2013 TAIL-F all rights reserved
TUTORIAL: NETCONF AND YANG
Must Statement
leaf max-weight {
type uint32 {
range "0..1000";
}
default 100;
must "sum(/sys:sys/interface[enabled = 'true']/weight)
< current()" {
error-message "The total weight exceeds the configured
max weight";
}
}
MAY 27, 2013 6©2013 TAIL-F all rights reserved
TUTORIAL: NETCONF AND YANG
Augment Statement
augment /sys:system/sys:user {
leaf expire {
type yang:date-and-time;
}
}
user
name classfull-nameuid expire
+
Default
MAY 27, 2013 7©2013 TAIL-F all rights reserved
TUTORIAL: NETCONF AND YANG
When Statement
augment /sys:system/sys:user {
when ”sys:class = ‘wheel’";
leaf shell {
type string;
}
}
user
name classfull-nameuid expire
+
Default
shell
When
MAY 27, 2013 8©2013 TAIL-F all rights reserved
TUTORIAL: NETCONF AND YANG
Choice Statement
Choice allows one of several
alternatives
choice transfer-method {
leaf transfer-interval {
description "Frequency at which file transfer happens";
type uint16 {
range "15 .. 2880";
}
units minutes;
}
leaf transfer-on-commit {
description "Transfer after each commit";
type empty;
}
}
transfer-interval
transfer-on-commit
transfer-method
MAY 27, 2013 9©2013 TAIL-F all rights reserved
TUTORIAL: NETCONF AND YANG
Choice Statement
Each alternative may consist of multiple definitions
• Either as a named or anonymous group
choice counters {
case four-counters {
leaf threshold {…}
leaf ignore-count {…}
leaf ignore-time {…}
leaf reset-time {…}
}
container warning-only {
…
}
default four-counters;
}
MAY 27, 2013 10©2013 TAIL-F all rights reserved
TUTORIAL: NETCONF AND YANG
Identity Statement
Identities for modeling families of related enumeration constants
module phys-if {
…
identity ethernet {
description
"Ethernet family of PHY
interfaces";
}
identity eth-1G {
base ethernet;
description "1 GigEth";
}
identity eth-10G {
base ethernet;
description "10 GigEth";
}
module newer {
…
identity eth-40G {
base phys-if:ethernet;
description "40 GigEth";
}
identity eth-100G {
base phys-if:ethernet;
description "100 GigEth";
}
…
leaf eth-type {
type identityref {
base ”phys-if:ethernet";
}
}
MAY 27, 2013 11©2013 TAIL-F all rights reserved
TUTORIAL: NETCONF AND YANG
Feature Statement
Mark data as conditional
feature has-local-disk {
description
“System has a local file
system that can be used
for storing log files”;
}
container system {
container logging {
if-feature has-local-disk;
presence “Logging enabled”;
leaf buffer-size {
type filesize;
}
}
}
system
logging
buffer-size
Feature, Presence
The features supported by a system are
meant to stay relatively constant. Adding
a feature is comparable to a hardware
upgrade.
MAY 27, 2013 12©2013 TAIL-F all rights reserved
TUTORIAL: NETCONF AND YANG
Deviations
Systems should conform to standard YANG models
• Still, if a device can’t, that can be properly declared
deviation /base:system/base:user/base:type {
deviate add {
default "admin"; // new users are 'admin' by default
}
}
deviation /base:system/base:name-server {
deviate replace {
max-elements 3;
}
}
MAY 27, 2013 13©2013 TAIL-F all rights reserved
TUTORIAL: NETCONF AND YANG
YANG Modeling Strategy
MAY 27, 2013 14©2013 TAIL-F all rights reserved
TUTORIAL: NETCONF AND YANG
Constraints
• On-board XPATH parser not required
• XPATH is more formal than English, that’s all
• Debate: “Configuration validity must not depend on state”
• Are operators right?
• What are the implications?
• min-elements
• max-elements
• range
• key/unique
• leafref
• must
• when
MAY 27, 2013 15©2013 TAIL-F all rights reserved
TUTORIAL: NETCONF AND YANG
Structure
• Model to mimic an existing interface?
• Model for which interfaces?
• YANG for NETCONF only?
• All interfaces uses the YANG model?
• Multiple models with transformations?
• Multiple models that allow writing?
• What goes in each namespace?
• One, a few or many namespaces?
• No configuration inside operational data
• SNMP transient configuration
MAY 27, 2013 16©2013 TAIL-F all rights reserved
TUTORIAL: NETCONF AND YANG
So what is configuration?
• What is in the factory default?
• Any probing at system boot?
• Do you want pre-provisioning?
• Do you want to support rollbacks?
• Inserting a board, is that an act of configuration?
• Do you need spontaneous reconfiguration?
• Where does the configuration data originate from?
MAY 27, 2013 17©2013 TAIL-F all rights reserved
TUTORIAL: NETCONF AND YANG
VersioningYANG Modules
You must / must not:
• Add a revision statement on
top
• Update organization, contact,
etc
• Do not rename module or
namespace
• Do not remove obsolete
definitions
• Do not reorder data
definitions
You may:
• Add enum, bits, typedef,
grouping, rpc, notification,
extension, feature, identity,
case
• Add non-mandatory data
definitions
• Add mandatory data
definitions within new if-
feature statements
 RFC 6020 sec 10
MAY 27, 2013 18©2013 TAIL-F all rights reserved
TUTORIAL: NETCONF AND YANG
VersioningYANG Modules (cont’d)
You may:
• Add or update a status
statement: current 
deprecated  obsolete
• Expand allowed range, length,
pattern
• Add a default
(but not change it!)
• Add units, add or update a
reference
You may:
• Change mandatory to false (or
remove it)
• Remove or relax min- & max-
elements
• Add or clarify a description
without changing the
semantics
• Change state data to optional
configuration
• Remove an if-feature
MAY 27, 2013 19©2013 TAIL-F all rights reserved
TUTORIAL: NETCONF AND YANG
IETF Modeling Recommendations
• Describe
• Module, security considerations, references, definitions, …
• Top level
• Only one data definition (typ. container) on top level
• Top level data definitions optional
• Enumerations that grow
• Use identityref instead of enumeration
MAY 27, 2013 20©2013 TAIL-F all rights reserved
TUTORIAL: NETCONF AND YANG
IETF Modeling Recommendations
• Specific types
• Use ranges, length restrictions, patterns
• Do not use signed types unless negative values needed
• Standard types
• When possible, use standard types,
e.g. ‘yang-types’ defined in RFC 6021
• Make your own reusable ‘type modules’
MAY 27, 2013 21©2013 TAIL-F all rights reserved
TUTORIAL: NETCONF AND YANG
Yin, YANG and YANG Extensions
MAY 27, 2013 22©2013 TAIL-F all rights reserved
TUTORIAL: NETCONF AND YANG
Yin – the XML representation of YANG
YANG 日
container dhcp {
leaf defaultLeaseTime {
type xs:duration;
default PT600S;
}
leaf maxLeaseTime {
type xs:duration;
default PT7200S;
}
leaf logFacility {
type loglevel;
default local7;
}
Yin 月
<container name="dhcp">
<leaf name="defaultLeaseTime">
<type name="xs:duration"/>
<default value="PT600S"/>
</leaf>
<leaf name="maxLeaseTime">
<type name="xs:duration"/>
<default value="PT7200S”/>
</leaf>
<leaf name="logFacility">
<type name="loglevel"/>
<default value="local7"/>
</leaf>
Lossless
Lossless
MAY 27, 2013 23©2013 TAIL-F all rights reserved
TUTORIAL: NETCONF AND YANG
YANG Extensions - Prototype
module prototype {
namespace "http://tail-f.com…
prefix prototype;
extension create {
argument keylist;
}
extension value {
argument value;
}
extension keylist-value {
argument keylist-value;
}
}
module xyz {
list y {
config false;
tailf:cdb-oper;
prototype:create "b=1,c=0";
prototype:create "b=6,c=0";
prototype:create "b=6,c=1";
key "b c";
leaf b { type int32; }
leaf c { type int32; }
leaf d {
type string;
prototype:keylist-value
"b=1,c=0,cool";
prototype:keylist-value
"b=6,c=1,green";
}
MAY 27, 2013 24©2013 TAIL-F all rights reserved
TUTORIAL: NETCONF AND YANG
YANG Extensions - Prototype
c "/xyz:x/xyz:y{1 0}"
c "/xyz:x/xyz:y{6 0}"
c "/xyz:x/xyz:y{6 1}"
s "/xyz:x/xyz:y{1 0}/xyz:d" "cool"
s "/xyz:x/xyz:y{6 1}/xyz:d" "green"
ubuntu# show x
B C D
-------------
1 0 cool
6 0 -
6 1 green
Prototype
.yang
XYZ
.yang
XYZ
init
data
XYZ
pyang
confdc
prototype.py
MAY 27, 2013 25©2013 TAIL-F all rights reserved
TUTORIAL: NETCONF AND YANG
Example:
Router Device Model (part of)
MAY 27, 2013 26©2013 TAIL-F all rights reserved
TUTORIAL: NETCONF AND YANG
Example: Quagga Types
submodule quagga_common {
belongs-to quagga {
prefix quagga;
}
…
include quagga_top;
typedef PrefixLengthIPv4 {
type uint8 { range 0 .. 32; }
}
…
grouping inetNetworkAddressIPv4 {
leaf address {
type inet:ipv4-address;
mandatory true;
}
leaf prefix-length {
type PrefixLengthIPv4;
mandatory true;
}
}
typedef MacAddressType {
type string {
length 17;
pattern "([0-9a-fA-F][0-9a-fA-F]:){5}
([0-9a-fA-F][0-9a-fA-F])";
}
}
typedef ACLLowRangeType {
type uint32 { range 1 .. 99; }
}
typedef ACLHighRangeType {
type uint32 { range 1300 .. 1999; }
}
typedef ACLExtType {
type union {
type ACLExtLowRangeType;
type ACLExtHighRangeType;
}
}
typedef InfiniteType {
type enumeration {
enum infinite;
}
}
typedef DateTimeInfiniteType {
type union {
type yang:date-and-time;
type InfiniteType;
}
}
MAY 27, 2013 27©2013 TAIL-F all rights reserved
TUTORIAL: NETCONF AND YANG
Example: Quagga Interface Configuration
submodule zebra_confd_if {
belongs-to quagga {
prefix quagga;
}
include confd_top;
include confd_common;
typedef BandwidthRangeType {
type uint64 { range "1 .. 10000000000"; }
}
augment "/system/interface" {
leaf bandwidth {
type BandwidthRangeType;
}
leaf link-detect {
type boolean;
default false;
}
leaf multicast {
type MulticastType;
default if-default;
}
leaf up {
type boolean;
default true;
}
}
}
submodule zebra_confd_if_ip {
belongs-to quagga {
prefix quagga;
}
import ietf-inet-types {
prefix inet;
}
include confd_top;
include confd_common;
augment "/system/interface/ip" {
list address {
key "address prefix-length";
leaf address {
type inet:ipv4-address;
}
leaf prefix-length {
type PrefixLengthIPv4;
}
leaf label {
type string;
}
}
}
}
MAY 27, 2013 28©2013 TAIL-F all rights reserved
TUTORIAL: NETCONF AND YANG
Example: Quagga Status & Notification
submodule zebra_confd_stats_memory {
belongs-to quagga {
prefix quagga;
}
import tailf-common {
prefix tailf;
}
include confd_top;
include confd_common;
augment "/system/stats/memory" {
container zebra {
config false;
tailf:callpoint "zebraGetMemory";
uses memoryStatusType;
}
}
}
notification saExpired {
leaf tunnelName {
type leafref {
path "/system/vpn/ipsec/tunnel/name";
}
mandatory true;
}
leaf spi {
type int64;
mandatory true;
}
}
MAY 27, 2013 29©2013 TAIL-F all rights reserved
TUTORIAL: NETCONF AND YANG
Example:
Q-in-Q Service Model
MAY 27, 2013 30©2013 TAIL-F all rights reserved
TUTORIAL: NETCONF AND YANG
Example: Q-in-Q Service Model (complete)
module qinq-service {
namespace "http://com/example/qinq-service";
prefix qinq;
import tailf-common { prefix tailf; }
import tailf-ncs { prefix ncs; }
list qinq {
key name;
leaf name { type string; }
leaf s-vlan {
mandatory true;
type uint32 { range 1..4094; }
}
must "not (/qt:qinq[name != current()/name]
[s-vlan = current()/s-vlan])” {
error-message "The s-vlan must be unique within
the network”
}
list edge-switch {
key switch;
leaf switch {
type leafref {path /ncs:devices/ncs:device/ncs:name;}
}
list edge-interface {
key interface;
leaf interface { type string; }
leaf-list c-vlan {
type uint32 { range 1..4094; }
}
}
leaf-list trunk-interface {
min-elements 1;
type string;
}
}
list core-switch {
key switch;
leaf switch {
type leafref {path /ncs:devices/ncs:device/ncs:name;}
}
leaf-list trunk-interface {
min-elements 1;
type string;
}
}
}
}
Module 6: YANG Tutorial - part 2

More Related Content

What's hot

Module 10: CDB Subscribers
Module 10: CDB SubscribersModule 10: CDB Subscribers
Module 10: CDB SubscribersTail-f Systems
 
Oracle WebLogic Server Basic Concepts
Oracle WebLogic Server Basic ConceptsOracle WebLogic Server Basic Concepts
Oracle WebLogic Server Basic ConceptsJames Bayer
 
A 30-minute Introduction to NETCONF and YANG
A 30-minute Introduction to NETCONF and YANGA 30-minute Introduction to NETCONF and YANG
A 30-minute Introduction to NETCONF and YANGTail-f Systems
 
Cisco commands List for Beginners (CCNA, CCNP)
Cisco commands List for Beginners (CCNA, CCNP)Cisco commands List for Beginners (CCNA, CCNP)
Cisco commands List for Beginners (CCNA, CCNP)DH Da Lat
 
Creating new service name for oracle database
Creating new service name for oracle databaseCreating new service name for oracle database
Creating new service name for oracle databaseRavi Kumar Lanke
 
Webinar: Applying REST to Network Management – An Implementor’s View
Webinar: Applying REST to Network Management – An Implementor’s View Webinar: Applying REST to Network Management – An Implementor’s View
Webinar: Applying REST to Network Management – An Implementor’s View Tail-f Systems
 
M|18 Architectural Overview: MariaDB MaxScale
M|18 Architectural Overview: MariaDB MaxScaleM|18 Architectural Overview: MariaDB MaxScale
M|18 Architectural Overview: MariaDB MaxScaleMariaDB plc
 
Cilium - Container Networking with BPF & XDP
Cilium - Container Networking with BPF & XDPCilium - Container Networking with BPF & XDP
Cilium - Container Networking with BPF & XDPThomas Graf
 
netconf, restconf, grpc_basic
netconf, restconf, grpc_basicnetconf, restconf, grpc_basic
netconf, restconf, grpc_basicGyewan An
 
Getting started with YANG
Getting started with YANGGetting started with YANG
Getting started with YANGCoreStack
 
Module 9: CDB Technical Intro
 Module 9: CDB Technical Intro Module 9: CDB Technical Intro
Module 9: CDB Technical IntroTail-f Systems
 
NETCONF Call Home
NETCONF Call Home NETCONF Call Home
NETCONF Call Home ADVA
 
SQLcl overview - A new Command Line Interface for Oracle Database
SQLcl overview - A new Command Line Interface for Oracle DatabaseSQLcl overview - A new Command Line Interface for Oracle Database
SQLcl overview - A new Command Line Interface for Oracle DatabaseJeff Smith
 
Postgres connections at scale
Postgres connections at scalePostgres connections at scale
Postgres connections at scaleMydbops
 
How to configure vlan, stp, dtp step by step guide
How to configure vlan, stp, dtp step by step guideHow to configure vlan, stp, dtp step by step guide
How to configure vlan, stp, dtp step by step guideIT Tech
 
Mikrotik router os qos best practice
Mikrotik router os qos best practiceMikrotik router os qos best practice
Mikrotik router os qos best practiceBassel Kablawi
 
Java 9 New Features
Java 9 New FeaturesJava 9 New Features
Java 9 New FeaturesAli BAKAN
 

What's hot (20)

Module 10: CDB Subscribers
Module 10: CDB SubscribersModule 10: CDB Subscribers
Module 10: CDB Subscribers
 
Oracle WebLogic Server Basic Concepts
Oracle WebLogic Server Basic ConceptsOracle WebLogic Server Basic Concepts
Oracle WebLogic Server Basic Concepts
 
A 30-minute Introduction to NETCONF and YANG
A 30-minute Introduction to NETCONF and YANGA 30-minute Introduction to NETCONF and YANG
A 30-minute Introduction to NETCONF and YANG
 
Cisco commands List for Beginners (CCNA, CCNP)
Cisco commands List for Beginners (CCNA, CCNP)Cisco commands List for Beginners (CCNA, CCNP)
Cisco commands List for Beginners (CCNA, CCNP)
 
Creating new service name for oracle database
Creating new service name for oracle databaseCreating new service name for oracle database
Creating new service name for oracle database
 
CCIE Lab - IGP Routing
CCIE Lab -  IGP Routing  CCIE Lab -  IGP Routing
CCIE Lab - IGP Routing
 
Webinar: Applying REST to Network Management – An Implementor’s View
Webinar: Applying REST to Network Management – An Implementor’s View Webinar: Applying REST to Network Management – An Implementor’s View
Webinar: Applying REST to Network Management – An Implementor’s View
 
M|18 Architectural Overview: MariaDB MaxScale
M|18 Architectural Overview: MariaDB MaxScaleM|18 Architectural Overview: MariaDB MaxScale
M|18 Architectural Overview: MariaDB MaxScale
 
Cilium - Container Networking with BPF & XDP
Cilium - Container Networking with BPF & XDPCilium - Container Networking with BPF & XDP
Cilium - Container Networking with BPF & XDP
 
netconf, restconf, grpc_basic
netconf, restconf, grpc_basicnetconf, restconf, grpc_basic
netconf, restconf, grpc_basic
 
Dataflow with Apache NiFi
Dataflow with Apache NiFiDataflow with Apache NiFi
Dataflow with Apache NiFi
 
Getting started with YANG
Getting started with YANGGetting started with YANG
Getting started with YANG
 
Module 9: CDB Technical Intro
 Module 9: CDB Technical Intro Module 9: CDB Technical Intro
Module 9: CDB Technical Intro
 
NETCONF Call Home
NETCONF Call Home NETCONF Call Home
NETCONF Call Home
 
SQLcl overview - A new Command Line Interface for Oracle Database
SQLcl overview - A new Command Line Interface for Oracle DatabaseSQLcl overview - A new Command Line Interface for Oracle Database
SQLcl overview - A new Command Line Interface for Oracle Database
 
Postgres connections at scale
Postgres connections at scalePostgres connections at scale
Postgres connections at scale
 
Bgp tutorial for ISP
Bgp tutorial for ISPBgp tutorial for ISP
Bgp tutorial for ISP
 
How to configure vlan, stp, dtp step by step guide
How to configure vlan, stp, dtp step by step guideHow to configure vlan, stp, dtp step by step guide
How to configure vlan, stp, dtp step by step guide
 
Mikrotik router os qos best practice
Mikrotik router os qos best practiceMikrotik router os qos best practice
Mikrotik router os qos best practice
 
Java 9 New Features
Java 9 New FeaturesJava 9 New Features
Java 9 New Features
 

Viewers also liked

Module 11: Operational Data Providers
Module 11: Operational Data ProvidersModule 11: Operational Data Providers
Module 11: Operational Data ProvidersTail-f Systems
 
Module 12: NETCONF Northbound Interface
Module 12: NETCONF Northbound InterfaceModule 12: NETCONF Northbound Interface
Module 12: NETCONF Northbound InterfaceTail-f Systems
 
Module 8: C Data Types
Module 8: C Data TypesModule 8: C Data Types
Module 8: C Data TypesTail-f Systems
 
Open Network OS Overview as of 2015/10/16
Open Network OS Overview as of 2015/10/16Open Network OS Overview as of 2015/10/16
Open Network OS Overview as of 2015/10/16Kentaro Ebisawa
 
Tail-f Webinar OpenFlow Switch Management Using NETCONF and YANG
Tail-f Webinar OpenFlow Switch Management Using NETCONF and YANGTail-f Webinar OpenFlow Switch Management Using NETCONF and YANG
Tail-f Webinar OpenFlow Switch Management Using NETCONF and YANGTail-f Systems
 
Dynamic Service Chaining
Dynamic Service Chaining Dynamic Service Chaining
Dynamic Service Chaining Tail-f Systems
 
Module 7: Installation and Getting Started
Module 7: Installation and Getting StartedModule 7: Installation and Getting Started
Module 7: Installation and Getting StartedTail-f Systems
 

Viewers also liked (7)

Module 11: Operational Data Providers
Module 11: Operational Data ProvidersModule 11: Operational Data Providers
Module 11: Operational Data Providers
 
Module 12: NETCONF Northbound Interface
Module 12: NETCONF Northbound InterfaceModule 12: NETCONF Northbound Interface
Module 12: NETCONF Northbound Interface
 
Module 8: C Data Types
Module 8: C Data TypesModule 8: C Data Types
Module 8: C Data Types
 
Open Network OS Overview as of 2015/10/16
Open Network OS Overview as of 2015/10/16Open Network OS Overview as of 2015/10/16
Open Network OS Overview as of 2015/10/16
 
Tail-f Webinar OpenFlow Switch Management Using NETCONF and YANG
Tail-f Webinar OpenFlow Switch Management Using NETCONF and YANGTail-f Webinar OpenFlow Switch Management Using NETCONF and YANG
Tail-f Webinar OpenFlow Switch Management Using NETCONF and YANG
 
Dynamic Service Chaining
Dynamic Service Chaining Dynamic Service Chaining
Dynamic Service Chaining
 
Module 7: Installation and Getting Started
Module 7: Installation and Getting StartedModule 7: Installation and Getting Started
Module 7: Installation and Getting Started
 

Similar to Module 6: YANG Tutorial - part 2

Boost Your Neo4j with User-Defined Procedures
Boost Your Neo4j with User-Defined ProceduresBoost Your Neo4j with User-Defined Procedures
Boost Your Neo4j with User-Defined ProceduresNeo4j
 
Cisco Connect Toronto 2018 model-driven programmability for cisco ios xr-v1
Cisco Connect Toronto 2018   model-driven programmability for cisco ios xr-v1Cisco Connect Toronto 2018   model-driven programmability for cisco ios xr-v1
Cisco Connect Toronto 2018 model-driven programmability for cisco ios xr-v1Cisco Canada
 
PLNOG19 - Krzysztof Mazepa - Yang Development Kit – stwórz swój pierwszy prog...
PLNOG19 - Krzysztof Mazepa - Yang Development Kit – stwórz swój pierwszy prog...PLNOG19 - Krzysztof Mazepa - Yang Development Kit – stwórz swój pierwszy prog...
PLNOG19 - Krzysztof Mazepa - Yang Development Kit – stwórz swój pierwszy prog...PROIDEA
 
Upcoming changes in MySQL 5.7
Upcoming changes in MySQL 5.7Upcoming changes in MySQL 5.7
Upcoming changes in MySQL 5.7Morgan Tocker
 
TensorFlow meetup: Keras - Pytorch - TensorFlow.js
TensorFlow meetup: Keras - Pytorch - TensorFlow.jsTensorFlow meetup: Keras - Pytorch - TensorFlow.js
TensorFlow meetup: Keras - Pytorch - TensorFlow.jsStijn Decubber
 
LOGBack and SLF4J
LOGBack and SLF4JLOGBack and SLF4J
LOGBack and SLF4Jjkumaranc
 
LOGBack and SLF4J
LOGBack and SLF4JLOGBack and SLF4J
LOGBack and SLF4Jjkumaranc
 
LOGBack and SLF4J
LOGBack and SLF4JLOGBack and SLF4J
LOGBack and SLF4Jjkumaranc
 
LOGBack and SLF4J
LOGBack and SLF4JLOGBack and SLF4J
LOGBack and SLF4Jjkumaranc
 
SQL Server 2008 Performance Enhancements
SQL Server 2008 Performance EnhancementsSQL Server 2008 Performance Enhancements
SQL Server 2008 Performance Enhancementsinfusiondev
 
Practical C++ Generative Programming
Practical C++ Generative ProgrammingPractical C++ Generative Programming
Practical C++ Generative ProgrammingSchalk Cronjé
 
Dataweave Libraries and ObjectStore
Dataweave Libraries and ObjectStoreDataweave Libraries and ObjectStore
Dataweave Libraries and ObjectStoreVikalp Bhalia
 
MySQL 8.0: What Is New in Optimizer and Executor?
MySQL 8.0: What Is New in Optimizer and Executor?MySQL 8.0: What Is New in Optimizer and Executor?
MySQL 8.0: What Is New in Optimizer and Executor?Norvald Ryeng
 
Postgres в основе вашего дата-центра, Bruce Momjian (EnterpriseDB)
Postgres в основе вашего дата-центра, Bruce Momjian (EnterpriseDB)Postgres в основе вашего дата-центра, Bruce Momjian (EnterpriseDB)
Postgres в основе вашего дата-центра, Bruce Momjian (EnterpriseDB)Ontico
 
2. Seamless Surveillance with Juniper networks.pdf
2. Seamless Surveillance with Juniper networks.pdf2. Seamless Surveillance with Juniper networks.pdf
2. Seamless Surveillance with Juniper networks.pdfPawachMetharattanara
 
Oo Design And Patterns
Oo Design And PatternsOo Design And Patterns
Oo Design And PatternsAnil Bapat
 
Mulesoftmeetup4th july
Mulesoftmeetup4th julyMulesoftmeetup4th july
Mulesoftmeetup4th julyAnurag Dwivedi
 
JShell: An Interactive Shell for the Java Platform
JShell: An Interactive Shell for the Java PlatformJShell: An Interactive Shell for the Java Platform
JShell: An Interactive Shell for the Java PlatformJavaDayUA
 
Php 5.6 From the Inside Out
Php 5.6 From the Inside OutPhp 5.6 From the Inside Out
Php 5.6 From the Inside OutFerenc Kovács
 

Similar to Module 6: YANG Tutorial - part 2 (20)

Boost Your Neo4j with User-Defined Procedures
Boost Your Neo4j with User-Defined ProceduresBoost Your Neo4j with User-Defined Procedures
Boost Your Neo4j with User-Defined Procedures
 
Cisco Connect Toronto 2018 model-driven programmability for cisco ios xr-v1
Cisco Connect Toronto 2018   model-driven programmability for cisco ios xr-v1Cisco Connect Toronto 2018   model-driven programmability for cisco ios xr-v1
Cisco Connect Toronto 2018 model-driven programmability for cisco ios xr-v1
 
PLNOG19 - Krzysztof Mazepa - Yang Development Kit – stwórz swój pierwszy prog...
PLNOG19 - Krzysztof Mazepa - Yang Development Kit – stwórz swój pierwszy prog...PLNOG19 - Krzysztof Mazepa - Yang Development Kit – stwórz swój pierwszy prog...
PLNOG19 - Krzysztof Mazepa - Yang Development Kit – stwórz swój pierwszy prog...
 
Upcoming changes in MySQL 5.7
Upcoming changes in MySQL 5.7Upcoming changes in MySQL 5.7
Upcoming changes in MySQL 5.7
 
TensorFlow meetup: Keras - Pytorch - TensorFlow.js
TensorFlow meetup: Keras - Pytorch - TensorFlow.jsTensorFlow meetup: Keras - Pytorch - TensorFlow.js
TensorFlow meetup: Keras - Pytorch - TensorFlow.js
 
LOGBack and SLF4J
LOGBack and SLF4JLOGBack and SLF4J
LOGBack and SLF4J
 
LOGBack and SLF4J
LOGBack and SLF4JLOGBack and SLF4J
LOGBack and SLF4J
 
LOGBack and SLF4J
LOGBack and SLF4JLOGBack and SLF4J
LOGBack and SLF4J
 
LOGBack and SLF4J
LOGBack and SLF4JLOGBack and SLF4J
LOGBack and SLF4J
 
SQL Server 2008 Performance Enhancements
SQL Server 2008 Performance EnhancementsSQL Server 2008 Performance Enhancements
SQL Server 2008 Performance Enhancements
 
Practical C++ Generative Programming
Practical C++ Generative ProgrammingPractical C++ Generative Programming
Practical C++ Generative Programming
 
Dataweave Libraries and ObjectStore
Dataweave Libraries and ObjectStoreDataweave Libraries and ObjectStore
Dataweave Libraries and ObjectStore
 
MySQL 8.0: What Is New in Optimizer and Executor?
MySQL 8.0: What Is New in Optimizer and Executor?MySQL 8.0: What Is New in Optimizer and Executor?
MySQL 8.0: What Is New in Optimizer and Executor?
 
Postgres в основе вашего дата-центра, Bruce Momjian (EnterpriseDB)
Postgres в основе вашего дата-центра, Bruce Momjian (EnterpriseDB)Postgres в основе вашего дата-центра, Bruce Momjian (EnterpriseDB)
Postgres в основе вашего дата-центра, Bruce Momjian (EnterpriseDB)
 
2. Seamless Surveillance with Juniper networks.pdf
2. Seamless Surveillance with Juniper networks.pdf2. Seamless Surveillance with Juniper networks.pdf
2. Seamless Surveillance with Juniper networks.pdf
 
Oo Design And Patterns
Oo Design And PatternsOo Design And Patterns
Oo Design And Patterns
 
14 operator overloading
14 operator overloading14 operator overloading
14 operator overloading
 
Mulesoftmeetup4th july
Mulesoftmeetup4th julyMulesoftmeetup4th july
Mulesoftmeetup4th july
 
JShell: An Interactive Shell for the Java Platform
JShell: An Interactive Shell for the Java PlatformJShell: An Interactive Shell for the Java Platform
JShell: An Interactive Shell for the Java Platform
 
Php 5.6 From the Inside Out
Php 5.6 From the Inside OutPhp 5.6 From the Inside Out
Php 5.6 From the Inside Out
 

Recently uploaded

Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 

Recently uploaded (20)

Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 

Module 6: YANG Tutorial - part 2

  • 1. YANG Tutorial – part 2 Presented by Tail-f
  • 2. MAY 27, 2013 2©2013 TAIL-F all rights reserved TUTORIAL: NETCONF AND YANG Advanced YANG Statements
  • 3. MAY 27, 2013 3©2013 TAIL-F all rights reserved TUTORIAL: NETCONF AND YANG Must Statement Restricts valid values by Xpath 1.0 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 ”current() < ../access-timeout" { error-app-tag retry-timer-invalid; error-message "The retry timer must be " + "less than the access timeout"; } } }
  • 4. MAY 27, 2013 4©2013 TAIL-F all rights reserved TUTORIAL: NETCONF AND YANG Must Statement leaf interface-group-name { type string { length "1..31"; pattern "[a-zA-Z][a-zA-Z0-9_-]*"; } must "not(/sys:sys/interface[name = current()])" { error-message ”Must be different from all interface names"; tailf:dependency "/sys:sys/interface/name"; } }
  • 5. MAY 27, 2013 5©2013 TAIL-F all rights reserved TUTORIAL: NETCONF AND YANG Must Statement leaf max-weight { type uint32 { range "0..1000"; } default 100; must "sum(/sys:sys/interface[enabled = 'true']/weight) < current()" { error-message "The total weight exceeds the configured max weight"; } }
  • 6. MAY 27, 2013 6©2013 TAIL-F all rights reserved TUTORIAL: NETCONF AND YANG Augment Statement augment /sys:system/sys:user { leaf expire { type yang:date-and-time; } } user name classfull-nameuid expire + Default
  • 7. MAY 27, 2013 7©2013 TAIL-F all rights reserved TUTORIAL: NETCONF AND YANG When Statement augment /sys:system/sys:user { when ”sys:class = ‘wheel’"; leaf shell { type string; } } user name classfull-nameuid expire + Default shell When
  • 8. MAY 27, 2013 8©2013 TAIL-F all rights reserved TUTORIAL: NETCONF AND YANG Choice Statement Choice allows one of several alternatives choice transfer-method { leaf transfer-interval { description "Frequency at which file transfer happens"; type uint16 { range "15 .. 2880"; } units minutes; } leaf transfer-on-commit { description "Transfer after each commit"; type empty; } } transfer-interval transfer-on-commit transfer-method
  • 9. MAY 27, 2013 9©2013 TAIL-F all rights reserved TUTORIAL: NETCONF AND YANG Choice Statement Each alternative may consist of multiple definitions • Either as a named or anonymous group choice counters { case four-counters { leaf threshold {…} leaf ignore-count {…} leaf ignore-time {…} leaf reset-time {…} } container warning-only { … } default four-counters; }
  • 10. MAY 27, 2013 10©2013 TAIL-F all rights reserved TUTORIAL: NETCONF AND YANG Identity Statement Identities for modeling families of related enumeration constants module phys-if { … identity ethernet { description "Ethernet family of PHY interfaces"; } identity eth-1G { base ethernet; description "1 GigEth"; } identity eth-10G { base ethernet; description "10 GigEth"; } module newer { … identity eth-40G { base phys-if:ethernet; description "40 GigEth"; } identity eth-100G { base phys-if:ethernet; description "100 GigEth"; } … leaf eth-type { type identityref { base ”phys-if:ethernet"; } }
  • 11. MAY 27, 2013 11©2013 TAIL-F all rights reserved TUTORIAL: NETCONF AND YANG Feature Statement Mark data as conditional feature has-local-disk { description “System has a local file system that can be used for storing log files”; } container system { container logging { if-feature has-local-disk; presence “Logging enabled”; leaf buffer-size { type filesize; } } } system logging buffer-size Feature, Presence The features supported by a system are meant to stay relatively constant. Adding a feature is comparable to a hardware upgrade.
  • 12. MAY 27, 2013 12©2013 TAIL-F all rights reserved TUTORIAL: NETCONF AND YANG Deviations Systems should conform to standard YANG models • Still, if a device can’t, that can be properly declared deviation /base:system/base:user/base:type { deviate add { default "admin"; // new users are 'admin' by default } } deviation /base:system/base:name-server { deviate replace { max-elements 3; } }
  • 13. MAY 27, 2013 13©2013 TAIL-F all rights reserved TUTORIAL: NETCONF AND YANG YANG Modeling Strategy
  • 14. MAY 27, 2013 14©2013 TAIL-F all rights reserved TUTORIAL: NETCONF AND YANG Constraints • On-board XPATH parser not required • XPATH is more formal than English, that’s all • Debate: “Configuration validity must not depend on state” • Are operators right? • What are the implications? • min-elements • max-elements • range • key/unique • leafref • must • when
  • 15. MAY 27, 2013 15©2013 TAIL-F all rights reserved TUTORIAL: NETCONF AND YANG Structure • Model to mimic an existing interface? • Model for which interfaces? • YANG for NETCONF only? • All interfaces uses the YANG model? • Multiple models with transformations? • Multiple models that allow writing? • What goes in each namespace? • One, a few or many namespaces? • No configuration inside operational data • SNMP transient configuration
  • 16. MAY 27, 2013 16©2013 TAIL-F all rights reserved TUTORIAL: NETCONF AND YANG So what is configuration? • What is in the factory default? • Any probing at system boot? • Do you want pre-provisioning? • Do you want to support rollbacks? • Inserting a board, is that an act of configuration? • Do you need spontaneous reconfiguration? • Where does the configuration data originate from?
  • 17. MAY 27, 2013 17©2013 TAIL-F all rights reserved TUTORIAL: NETCONF AND YANG VersioningYANG Modules You must / must not: • Add a revision statement on top • Update organization, contact, etc • Do not rename module or namespace • Do not remove obsolete definitions • Do not reorder data definitions You may: • Add enum, bits, typedef, grouping, rpc, notification, extension, feature, identity, case • Add non-mandatory data definitions • Add mandatory data definitions within new if- feature statements  RFC 6020 sec 10
  • 18. MAY 27, 2013 18©2013 TAIL-F all rights reserved TUTORIAL: NETCONF AND YANG VersioningYANG Modules (cont’d) You may: • Add or update a status statement: current  deprecated  obsolete • Expand allowed range, length, pattern • Add a default (but not change it!) • Add units, add or update a reference You may: • Change mandatory to false (or remove it) • Remove or relax min- & max- elements • Add or clarify a description without changing the semantics • Change state data to optional configuration • Remove an if-feature
  • 19. MAY 27, 2013 19©2013 TAIL-F all rights reserved TUTORIAL: NETCONF AND YANG IETF Modeling Recommendations • Describe • Module, security considerations, references, definitions, … • Top level • Only one data definition (typ. container) on top level • Top level data definitions optional • Enumerations that grow • Use identityref instead of enumeration
  • 20. MAY 27, 2013 20©2013 TAIL-F all rights reserved TUTORIAL: NETCONF AND YANG IETF Modeling Recommendations • Specific types • Use ranges, length restrictions, patterns • Do not use signed types unless negative values needed • Standard types • When possible, use standard types, e.g. ‘yang-types’ defined in RFC 6021 • Make your own reusable ‘type modules’
  • 21. MAY 27, 2013 21©2013 TAIL-F all rights reserved TUTORIAL: NETCONF AND YANG Yin, YANG and YANG Extensions
  • 22. MAY 27, 2013 22©2013 TAIL-F all rights reserved TUTORIAL: NETCONF AND YANG Yin – the XML representation of YANG YANG 日 container dhcp { leaf defaultLeaseTime { type xs:duration; default PT600S; } leaf maxLeaseTime { type xs:duration; default PT7200S; } leaf logFacility { type loglevel; default local7; } Yin 月 <container name="dhcp"> <leaf name="defaultLeaseTime"> <type name="xs:duration"/> <default value="PT600S"/> </leaf> <leaf name="maxLeaseTime"> <type name="xs:duration"/> <default value="PT7200S”/> </leaf> <leaf name="logFacility"> <type name="loglevel"/> <default value="local7"/> </leaf> Lossless Lossless
  • 23. MAY 27, 2013 23©2013 TAIL-F all rights reserved TUTORIAL: NETCONF AND YANG YANG Extensions - Prototype module prototype { namespace "http://tail-f.com… prefix prototype; extension create { argument keylist; } extension value { argument value; } extension keylist-value { argument keylist-value; } } module xyz { list y { config false; tailf:cdb-oper; prototype:create "b=1,c=0"; prototype:create "b=6,c=0"; prototype:create "b=6,c=1"; key "b c"; leaf b { type int32; } leaf c { type int32; } leaf d { type string; prototype:keylist-value "b=1,c=0,cool"; prototype:keylist-value "b=6,c=1,green"; }
  • 24. MAY 27, 2013 24©2013 TAIL-F all rights reserved TUTORIAL: NETCONF AND YANG YANG Extensions - Prototype c "/xyz:x/xyz:y{1 0}" c "/xyz:x/xyz:y{6 0}" c "/xyz:x/xyz:y{6 1}" s "/xyz:x/xyz:y{1 0}/xyz:d" "cool" s "/xyz:x/xyz:y{6 1}/xyz:d" "green" ubuntu# show x B C D ------------- 1 0 cool 6 0 - 6 1 green Prototype .yang XYZ .yang XYZ init data XYZ pyang confdc prototype.py
  • 25. MAY 27, 2013 25©2013 TAIL-F all rights reserved TUTORIAL: NETCONF AND YANG Example: Router Device Model (part of)
  • 26. MAY 27, 2013 26©2013 TAIL-F all rights reserved TUTORIAL: NETCONF AND YANG Example: Quagga Types submodule quagga_common { belongs-to quagga { prefix quagga; } … include quagga_top; typedef PrefixLengthIPv4 { type uint8 { range 0 .. 32; } } … grouping inetNetworkAddressIPv4 { leaf address { type inet:ipv4-address; mandatory true; } leaf prefix-length { type PrefixLengthIPv4; mandatory true; } } typedef MacAddressType { type string { length 17; pattern "([0-9a-fA-F][0-9a-fA-F]:){5} ([0-9a-fA-F][0-9a-fA-F])"; } } typedef ACLLowRangeType { type uint32 { range 1 .. 99; } } typedef ACLHighRangeType { type uint32 { range 1300 .. 1999; } } typedef ACLExtType { type union { type ACLExtLowRangeType; type ACLExtHighRangeType; } } typedef InfiniteType { type enumeration { enum infinite; } } typedef DateTimeInfiniteType { type union { type yang:date-and-time; type InfiniteType; } }
  • 27. MAY 27, 2013 27©2013 TAIL-F all rights reserved TUTORIAL: NETCONF AND YANG Example: Quagga Interface Configuration submodule zebra_confd_if { belongs-to quagga { prefix quagga; } include confd_top; include confd_common; typedef BandwidthRangeType { type uint64 { range "1 .. 10000000000"; } } augment "/system/interface" { leaf bandwidth { type BandwidthRangeType; } leaf link-detect { type boolean; default false; } leaf multicast { type MulticastType; default if-default; } leaf up { type boolean; default true; } } } submodule zebra_confd_if_ip { belongs-to quagga { prefix quagga; } import ietf-inet-types { prefix inet; } include confd_top; include confd_common; augment "/system/interface/ip" { list address { key "address prefix-length"; leaf address { type inet:ipv4-address; } leaf prefix-length { type PrefixLengthIPv4; } leaf label { type string; } } } }
  • 28. MAY 27, 2013 28©2013 TAIL-F all rights reserved TUTORIAL: NETCONF AND YANG Example: Quagga Status & Notification submodule zebra_confd_stats_memory { belongs-to quagga { prefix quagga; } import tailf-common { prefix tailf; } include confd_top; include confd_common; augment "/system/stats/memory" { container zebra { config false; tailf:callpoint "zebraGetMemory"; uses memoryStatusType; } } } notification saExpired { leaf tunnelName { type leafref { path "/system/vpn/ipsec/tunnel/name"; } mandatory true; } leaf spi { type int64; mandatory true; } }
  • 29. MAY 27, 2013 29©2013 TAIL-F all rights reserved TUTORIAL: NETCONF AND YANG Example: Q-in-Q Service Model
  • 30. MAY 27, 2013 30©2013 TAIL-F all rights reserved TUTORIAL: NETCONF AND YANG Example: Q-in-Q Service Model (complete) module qinq-service { namespace "http://com/example/qinq-service"; prefix qinq; import tailf-common { prefix tailf; } import tailf-ncs { prefix ncs; } list qinq { key name; leaf name { type string; } leaf s-vlan { mandatory true; type uint32 { range 1..4094; } } must "not (/qt:qinq[name != current()/name] [s-vlan = current()/s-vlan])” { error-message "The s-vlan must be unique within the network” } list edge-switch { key switch; leaf switch { type leafref {path /ncs:devices/ncs:device/ncs:name;} } list edge-interface { key interface; leaf interface { type string; } leaf-list c-vlan { type uint32 { range 1..4094; } } } leaf-list trunk-interface { min-elements 1; type string; } } list core-switch { key switch; leaf switch { type leafref {path /ncs:devices/ncs:device/ncs:name;} } leaf-list trunk-interface { min-elements 1; type string; } } } }