Netconf/YANG Tutorial: Evgeny Zobnitsev
Netconf/YANG Tutorial: Evgeny Zobnitsev
2
Network configuration management today
● Various proprietary CLIs of the network elements (NEs)
● Various proprietary APIs of the network elements and
controller
● Manual configuration or expect scripts, as automation
● Imperative, incremental NEs configuration, lack of
abstractions
● Configuration screen scraping from NEs, using parsing
− The most bad thing, no programmatic knowledge when
the CLI command finished.
− CLI designed to work with humans, not machines.
● SNMP - has not solved this problems (see RFC3535)
3
Network configuration management today
● Service lifecycle management - workflow-based
− Workflows describes to the provisioning system, in
detail, which steps to take to reach a final state.
− Each service livecycle action has to be explicitly
defined: service create, service change, service edit,
service delete.
4
Network application life cycle today
5
Network configuration management today
● Model-driven topology of the network
− describes structure of the network.
● Model-driven services description, auto-generating APIs
− describes structure of the network services, APIs.
● Model-driven configuration of the network elements
(NEs)
− describes structure of network element configuration,
provided and supported by vendor.
● Model-driven telemetry of the network elements (NEs)
− describes structure of network element supported
telemetry, provided and supported by vendor.
6
Network application life cycle (End-to-End Model-Driven )
7
Comparison of Workflow-based and
Model-to-model service-to-network mapping
8
Agenda
9
Key Features of NETCONF (RFC6241)
● Domain-Specific Knowledge
− NETCONF was specifically developed to support network configuration
● Support for Transactionality
− NETCONF support Atomicity, Consistency, Isolation, Durability (ACID)
transactionality
● Vendor Device Independence
− NETCONF has abilities to get capabilities just from device during <hello>
exchange
● Support of run RPCs to run actions
− NETCONF has abilities to run the RPC that device support
● Device versions built-in support
− NETCONF has abilities to run <get-schema> RPC, to download YANG
model of device configuration just from device itself
10
NETCONF Transport
NETCONF messages are encoded in XML
● Each message is framed by:
− NETCONF 1.0: a character sequence ]]>]]>
− NETCONF 1.1: a line with the number of characters to read in ASCII
● NETCONF messages are encrypted by SSH,SSH provides authentication,
integrity and confidentiality
● NETCONF is connected oriented using TCP
● When a NETCONF Manager connects to a NETCONF Server (NE), they send
<hello> message
● The contents of the <hello> message declares which NETCONF Capabilities
each party is capable of.
● By declaring support for a capability in <hello>, the manager will know which
operations it can submit to the NE.
● Extensions go in separate XML namespaces, which makes it easier to build
backwards and forwards compatible management applications
11
Agenda
12
Key Features of RESTCONF (RFC 8040)
● uniform, standardized way for Web applications to access the
configuration data, state data, data-model-specific Remote Procedure
Call (RPC) operations, and event notifications within a network
element.
● operates on the configuration datastores defined in NETCONF and
defines a set of CRUD operations that can be used to access these
datastores.
● YANG language defined
● uses URI-encoded path expressions to identify the YANG data nodes
unlike NETCONF, that using XPath expressions, starting from the
document root to the target resource.
● operates on a hierarchy of resources are accessed via a set of URIs
using syntax specified in RFC 8040
13
RESTCONF HTTP methods vs NETCONF
RESTCONF operation Description NETCONF operation
HEAD Get without a body <none>
OPTION Discover which operations are <none>
supported by a data resource
GET Retrieve data and metadata <get>, <get-config>
14
RESTCONF HTTP methods vs NETCONF
15
Agenda
16
Key Features of Yang (RFC6020)
● Service & NE Data Models vs. Information Models (UML)
− Yang is the data modeling language
● Domain-Specific Language
− Yang was specifically developed to support network configuration
● NE configuration modeling
− Yang is rich enough to model NE configuration (often follow the CLI)
● Service configuration modeling
− Yang is rich enough to model services in the same language as the NE
● Network topology modeling
− Any new device can be supported, by publishing Yang
● Vendors must create and publish Yang models of their own devices via ietf-
netconf-monitoring RFC feature
17
New Features of Yang (RFC7950)
YANG version 1.1 is a maintenance release of the YANG language, addressing
ambiguities and defects in the original specification [RFC6020].
Key changes (not all of them):
● A server advertises support for YANG 1.1 modules by using ietf-yang-library
[RFC7895] instead of listing them as capabilities in the <hello> message.
● Added a set of new XML Path Language (XPath) functions
● Allow "augment" to add conditionally mandatory nodes
● Allow imports of multiple revisions of a module
● Made the "yang-version" statement mandatory in YANG version "1.1”
● Allow "if-feature" in "bit", "enum", and "identity”
● Allow notifications to be tied to data nodes
● Added a new statement "action", which is used to define operations tied to data
nodes
● Allow notifications to be tied to data nodes
18
Yang module definition example
module mplsl3vpn { list endpoint {
namespace "http://ru/fgts/mplsl3vpn"; leaf pe-device {
description "PE-device selection";
prefix mplsl3vpn;
mandatory true;
import ietf-inet-types { type leafref {
prefix inet; path "/system:devices/system:device\
} /system:name";
import junos { }
prefix junos; }
container interfaces {
}
description "Interface parameters on the PE-device";
include "ietf-bgp-l3vpn"; leaf interface {
organization "Factor Group"; type leafref {
contact e@zobnitsev.ru; path deref(../../pe-device)/../system:config/
description "This is MPLS L3VPN junos:configuration/junos\
service for FGTS Lab"; :interfaces/junos:interface/junos:name;
revision 2014-02-20 { }
}
description "Initial revision.";
}
}
19
Protocols interaction & standardization
the eXtracting Yang Module Python script for IETF +--rw mplsl3vpn* [name]
+--rw name
+--ro modified
string
-> /ncs:devices/device/name
generator, written in python, lead by Martin | +--ro services*
+--rw rt
instance-identifier
string
22
Visual dependency tool – f.e. ietf-ip
24
Agenda
25
What is OpenDaylight?
26
OpenDaylight: a Yang-based microservices Platform
● Based on Model-
Driven Service OSS/BSS/CMS Controlled
Abstraction Layer (External Apps) YANG- Devices
modeled
(MD-SAL) Interfaces
● Yang
● Data Modeling NB NB
App App
SB SB
Language for API API Protocol Protocol
YANG-
NETCONF modeled
● Creates well- Notifications
Interfaces
defined APIs MD-SAL RPCs Data
● Java and Clustering
RESTCONF APIs
auto-generated
from Yang
27
MD-SAL = Model-Driven Service Abstraction Layer
Applications
Paths … … MD-SAL
Flow Flow Flow Flow Flow Flow
JAVA SAL APIs (Generated)
BGP-LS
… PCEP OF x.y OfConfig / OVSDB NETCONF RESTCONF
Network Elements
28
ODL project dependencies
29
Java, Interface, Maven, OSGi, Karaf
30
Java, Interface, Maven, OSGi, Karaf
31
NETCONF connector
32
NETCONF connector (advanced config)
● Advanced configuration
− Schema-cache-directory
− Reconnect-on-changed-schema
− Connection-timeout-millis
− Default-request-timeout-millis
− Max-connection-attempts
− Between-attempts-timeout-millis
− Sleep-factor
− Keepalive-delay
− Yang-module-capabilities
− Yang library
− Concurrent rpc limit
33
NETCONF connector - what available
● Get datastore
− yang-ext:mount
● Invoke RPC (POST)
− yang-ext:/mount/<module>:<operation>
● Update/Delete a netconf-connector
● Get/Set/Modify mounted NEs configuration
● Get the operational datastore
● Receive notifications from NETCONF NE
34
Agenda
35
vrnetlab – tool for service models CI/CT/CD
36
vrnetlab – tool for service models CI/CT/CD
37
vrnetlab – tool for service models CI/CT/CD
38
Join LFN meetup!
https://www.meetup.com/Open-Source-Networking-Moscow/
39
Thank you !
Evgeny Zobnitsev
e-mail: e@zobnitsev.ru
twitter: @ezobn