Spanish - Automatización de Redes
Spanish - Automatización de Redes
Oscar Ramírez
Systems Engineer
May 2019
Agenda
• The Road to Model Driven Programmability
• Introduction to YANG Data Models
• Introduction to NETCONF
• Introduction to RESTCONF
• Conclusion and Q/A
2
Why Network Programmability
6
RFC 3535: What is Needed?
• A programmatic interface for device
configuration
• Separation of Configuration and
State Data
• Ability to configure "services" NOT
"devices"
• Integrated error checking and
recovery
7
Model Driven Programmability
• NETCONF – 2006 – RFC 4741
(RFC 6241 in 2011)
• YANG – 2010 – RFC 6020
• RESTCONF – 2017 – RFC 8040
• gRPC – 2015 – OpenSource project
by Google
• Not covered in today’s session
8
What is YANG?
YANG Modeling Language
• Yet Another Next Generation (YANG) data modeling
language – RFC 6020
• Language for describing network devices data models
• YANG data models are composed of modules which represent
individual YANG files
• YANG modules are hierarchical tree structures for organizing
data
•
10
YANG Characteristics module ietf-interfaces {
import ietf-yang-types {
• Module that is a self-contained top- prefix yang;
level hierarchy of nodes }
container interfaces {
• Uses containers to group related nodes list interface {
• Lists to identify nodes that are stored key "name";
in sequence leaf name {
type string;
• Each individual attribute of a node is }
represented by a leaf leaf enabled {
type boolean;
• Every leaf must have an
default "true";
associated type }
© 2018 Cisco and/or its affiliates. All rights reserved.
}
YANG Variables
Open Native
Device Features
SNMP
Interface BGP QoS ACL …
pyang
An extensible YANG validator and converter in
Python.
https://github.com/mbj4668/pyang
ydk-gen
Extensions to pyang for generating code from
YANG models.
https://github.com/CiscoDevNet/ydk-gen
yang-explorer
An open-source YANG browser and RPC builder
application.
https://github.com/CiscoDevNet/yang-explorer
• YANG Explorer
• YANG Catalog
17
NETCONF Protocol Stack
interface_filter = '''
<filter xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
Filter<interfaces-state xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
<interface>
<name>GigabitEthernet1</name>
</interface>
</interfaces-state>
</filter>
''' Method
result = m.get(interface_filter)
© 2018 Cisco and/or its affiliates. All rights reserved.
xml_doc = xml.dom.minidom.parseString(result.xml) Parsing XML
NETCONF Response
<rpc-reply message-id="urn:uuid:50bf9d6e-7e5c-4182-ae6b-972a055ceef7" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"
xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
<data>
<interfaces-state xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
<interface>
<name>GigabitEthernet1</name>
<admin-status>up</admin-status>
<oper-status>up</oper-status>
<phys-address>00:0c:29:6c:81:06</phys-address>
<speed>1024000000</speed>
<statistics>
<in-octets>5432293472</in-octets>
<in-unicast-pkts>28518075</in-unicast-pkts>
……………
<out-octets>2901845514</out-octets>
<out-unicast-pkts>18850398</out-unicast-pkts>
</statistics>
</interface>
</interfaces-state>
</data></rpc-reply>
RESTCONF NETCONF
GET <get> , <get-config>
POST <edit-config> (operation="create")
PUT <edit-config> (operation="create/replace")
PATCH <edit-config> (operation="merge")
DELETE <edit-config> (operation="delete")
url = 'https://RO_HOST/restconf/data/interfaces-state/interface=GigabitEthernet1'
Device
Headers
header = {'Content-type': 'application/yang-data+json',
'accept': 'application/yang-data+json'}
Method Authentication
response = requests.get(url, headers=header, verify=False, auth=ROUTER_AUTH)
Session-layer Service
(RPC) Support ✓ ✓
Connection Oriented ✓ ✗
• NETCONF • YANG
• RESTCONF
35
The Network As It Could Be…In a ‘Hybrid SDN’
A Controller is centralized and separated from the Physical Device, but devices still retain
localized Control plane intelligence.