NCClient: A Python Library for NETCONF Client Applications



Similar documents
Network Configuration Management Using NETCONF and YANG

VoIP Security Management

Spring Bahador Bakhshi CE & IT Department, Amirkabir University of Technology. This presentation is based on the slides listed in references.

Implementing Existing Management Protocols on Constrained Devices. IETF 81, Quebec,

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

Easy configuration of NETCONF devices

NCS. EMS/NMS Platforms for Network Equipment Providers

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

Automating Network and Service Configuration Using NETCONF and YANG

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

Replication and High-Availability

OpenFlow Configuration and Management Protocol OF-CONFIG 1.0

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

Design Document. Offline Charging Server (Offline CS ) Version i -

NETCONF-based Integrated Management for Internet of Things using RESTful Web Services

ObserveIT Ticketing Integration Guide

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

ACS 5.x and later: Integration with Microsoft Active Directory Configuration Example

IBM Tivoli Netcool Configuration Manager 6.3 Administration and Implementation

Firewall Builder Architecture Overview

Application Note: Cisco Integration with Onsight Connect

ObserveIT Service Desk Integration Guide

SCOPTEL WITH ACTIVE DIRECTORY USER DOCUMENTATION

Managing your Red Hat Enterprise Linux guests with RHN Satellite

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

GS1 Trade Sync Connectivity guide

Jenkins XML API and Mobile Devices

Understanding The Brocade SDN Controller Architecture

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

Detecting Embedded Devices using Network Discovery

mod_tcl TCL inside the Apache web server

The Native AFS Client on Windows The Road to a Functional Design. Jeffrey Altman, President Your File System Inc.

shodan-python Documentation

CiscoWorks Resource Manager Essentials 4.3

Leveraging Cloud Storage Through Mobile Applications Using Mezeo Cloud Storage Platform REST API. John Eastman Mezeo

USER GUIDE. Lightweight Directory Access Protocol (LDAP) Schoolwires Centricity

Backing Up and Restoring Data

Enabling Remote Access to the ACE

A Guide to NETCONF for SNMP Developers

/ Preparing to Manage a VMware Environment Page 1

OpenConfig: collaborating to enable programmable network management

OSSIM. Open Source Security Information Management. Brian E. Lavender. Sac State. CSC 250, Spring Final Project

Web Application Threats and Vulnerabilities Web Server Hacking and Web Application Vulnerability

Network Configuration in OpenFlow Networks

Configuring Syslog Server on Cisco Routers with Cisco SDM

Basic & Advanced Administration for Citrix NetScaler 9.2

Monitoring Infrastructure (MIS) Software Architecture Document. Version 1.1

Specific Simple Network Management Tools

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

ObserveIT User Activity Monitoring software meets the complex compliance and security challenges related to user activity auditing.

Apache Thrift and Ruby

Multiprogramming. IT 3123 Hardware and Software Concepts. Program Dispatching. Multiprogramming. Program Dispatching. Program Dispatching

Windows PowerShell Cookbook

Smart Management for Robust Carrier Network Health & Reduced TCO. Colby Barth, Distinguished Engineer, Juniper Networks

Comodo Certificate Manager Version 5.4

Simplifying the Management of Virtualized Network Elements in

How To Synchronize With Gmail For Business On Shoretel

SoftNAS Application Guide: In-Flight Encryption 12/7/2015 SOFTNAS LLC

Authentication and Single Sign On

Cisco Network Services Orchestrator enabled by Tail-f Multi-Vendor Service Automation & Network Programmability Stefan Vallin, Ph D

Automation Tools for UCS Sysadmins

fåíéêåéí=péêîéê=^çãáåáëíê~íçêûë=dìáçé

WORKING WITH WINDOWS FIREWALL IN WINDOWS 7

ConfD. Powerful On-Device Management Software for Networking Equipment

Advanced Administration for Citrix NetScaler 9.0 Platinum Edition

CiscoWorks Resource Manager Essentials 4.1

OF 1.3 Testing and Challenges

Tcl and Cloud Computing Automation

Migration Quick Reference Guide for Administrators

Tail-f Network Control System 3.3 Getting Started Guide

How to upload large files to a JTAC Case

Chapter 11 Distributed File Systems. Distributed File Systems

ICINGA2 OPEN SOURCE MONITORING

Using LiveAction with Cisco Secure ACS (TACACS+ Server)

Understanding Task Scheduler FIGURE Task Scheduler. The error reporting screen.

VIDEO intypedia007en LESSON 7: WEB APPLICATION SECURITY - INTRODUCTION TO SQL INJECTION TECHNIQUES. AUTHOR: Chema Alonso

Enterprise IT is complex. Today, IT infrastructure spans the physical, the virtual and applications, and crosses public, private and hybrid clouds.

TPAf KTl Pen source. System Monitoring. Zenoss Core 3.x Network and

Edit system files. Delete file. ObserveIT Highlights. Change OS settings. Change password. See exactly what users are doing!

Connecting to the Firewall Services Module and Managing the Configuration

Integrating Juniper Netscreen (ScreenOS)

PANOS REST API October 2011 Business Development

Specify the location of an HTML control stored in the application repository. See Using the XPath search method, page 2.

Vistara Lifecycle Management

RPC and TI-RPC Test Suite Test Plan Document

Better management of large-scale, heterogeneous networks toward a programmable management plane

ENABLING WIRELESS DATA COMMUNICATION IN CONSTRUCTION MANAGEMENT SYSTEM

Spectrum Technology Platform. Version 9.0. Spectrum Spatial Administration Guide

ArcGIS for Server: Administrative Scripting and Automation

ASA Remote Access VPN with OCSP Verification under Microsoft Windows 2012 and OpenSSL

Telnet, Console and AUX Port Passwords on Cisco Routers Configuration Example

Identity and Access Management Integration with PowerBroker. Providing Complete Visibility and Auditing of Identities

Technical Overview Emif Connector

Improving PCI Compliance with Network Configuration Automation

Transcription:

NCClient: A Python Library for NETCONF Client Applications Shikhar Bhushan, Ha Manh Tran, Jürgen Schönwälder IPOM 2009, Venice, 2009-10-30 Support: EU IST-EMANICS Network of Excellence (26854) 1 / 1

Outline of the Talk 2 / 1

NETCONF in a Nutshell 3 / 1

What is NETCONF? NETCONF is a network management protocol specifically designed to support configuration management NETCONF provides the following features: distinction between configuration and state data multiple configuration datastores (running, startup,... ) support for configuration change transactions configuration testing and validation support selective data retrieval with filtering streaming and playback of event notifications extensible remote procedure call mechanism 4 / 1

NETCONF Layers (do not trust RFC 4741) Layer Example (4) Content Configuration data Notification data (3) Operations <get>, <get config>, <edit config>,... <eventtype> (2) Messages <rpc>, <rpc reply> <notification> (1) Secure Transports SSH, TLS, BEEP, SOAP/HTTPS George: Think CMIP of 21st century ;-) 5 / 1

NETCONF Operations Operation Arguments get-config source [filter] edit-config target [default-operation] [test-option] [error-option] config copy-config target source delete-config target lock target unlock target get [filter] close-session kill-session session-id discard-changes validate source commit [confirmed confirm-timeout] create-subscription [stream] [filter] [start] [stop] 6 / 1

Transaction Models Direct Model <edit config> running Candidate Model (optional) <edit config> candidate <commit> running Distinct Startup Model (optional) <edit config> <commit> running <copy config> startup Some operations (edit-config) support different error behaviours, including rollback behaviours 7 / 1

NCClient Sales Pitch 8 / 1

What is NCClient? high-level Python API for NETCONF extensibility to accomodate future protocol extensions additional transports additional protocol capabilities additional remote procedure calls request pipelining asynchronous and synchronous RPC calls robustness through proper error/exception handling thread safety exploit Python programming language features context managers for sessions and locks exception handling open source (http://code.google.com/p/ncclient) 9 / 1

UML Diagram for Sessions and Transports <<abstract>> Session +connect(...) +add_listener(...) +send(...) +... derives 1 has 0..* uses <<abstract>> SessionListener +callback(...) +errback(...) +... derives SSHSession +load_known_hosts(...) +... HelloHandler +make(...) +parse(...) +... Future transports can be plugged into NCClient by deriving additional classes from Session 10 / 1

UML Diagram for RPCs and Operations <<abstract>> SessionListener +callback(...) +errback(...) +... derives RPCReplyListener +register(...) +... 1 <<abstract>> RPC +request(...) 0..* +set_timeout(...) +... 1 concerns has RPCReply +parse(...) +... 1 has 0..* RPCError 0..1 derives derives GetReply Get GetConfig EditConfig Lock Future operations can be plugged into NCClient by deriving additional classes from RPC... 11 / 1

Supported Capabilities Capability :writable-running :candidate :confirmed-commit :rollback-on-error :startup :url :validate :xpath :notification :interleave Supported 12 / 1

Interoperability Tests Operation Tail-f Cisco Netopeer get-config edit-config copy-config delete-config lock unlock get close-session kill-session discard-changes validate commit 13 / 1

Examples / Demonstration 14 / 1

! /usr/bin/env python2.6 Connect to the NETCONF server passed on the command line and display their capabilities. This script and the following scripts all assume that the user calling the script is known by the server and that suitable SSH keys are in place. For brevity and clarity of the examples, we omit proper exception handling. $./nc01.py broccoli import sys, os, warnings warnings.simplefilter("ignore", DeprecationWarning) from ncclient import manager def demo(host, user): with manager.connect(host=host, port=22, username=user) as m: for c in m.server_capabilities: print c if name == main : demo(sys.argv[1], os.getenv("user")) 15 / 1

! /usr/bin/env python2.6 Retrieve the running config from the NETCONF server passed on the command line using get-config and write the XML configs to files. $./nc02.py broccoli import sys, os, warnings warnings.simplefilter("ignore", DeprecationWarning) from ncclient import manager def demo(host, user): with manager.connect(host=host, port=22, username=user) as m: c = m.get_config(source= running ).data_xml with open("%s.xml" % host, w ) as f: f.write(c) if name == main : demo(sys.argv[1], os.getenv("user")) 16 / 1

! /usr/bin/env python2.6 Retrieve a portion selected by an XPATH expression from the running config from the NETCONF server passed on the command line using get-config and write the XML configs to files. $./nc03.py broccoli "aaa/authentication/users/user[name= schoenw ]" import sys, os, warnings warnings.simplefilter("ignore", DeprecationWarning) from ncclient import manager def demo(host, user, expr): with manager.connect(host=host, port=22, username=user) as m: assert(":xpath" in m.server_capabilities) c = m.get_config(source= running, filter=( xpath, expr)).data_xml with open("%s.xml" % host, w ) as f: f.write(c) if name == main : demo(sys.argv[1], os.getenv("user"), sys.argv[2]) 17 / 1

! /usr/bin/env python2.6 Create a new user to the running configuration using edit-config and the test-option provided by the :validate capability. $./nc04.py broccoli bob 42 42 import sys, os, warnings warnings.simplefilter("ignore", DeprecationWarning) from ncclient import manager def demo(host, user, name, uid, gid): snippet = """<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0"> <aaa xmlns="http://tail-f.com/ns/aaa/1.1"> <authentication> <users> <user xc:operation="create"> <name>%s</name> <uid>%s</uid> <gid>%s</gid> <password>*</password> <ssh_keydir/> <homedir/> </user></users></authentication></aaa></config>""" % (name, uid, gid) with manager.connect(host=host, port=22, username=user) as m: assert(":validate" in m.server_capabilities) m.edit_config(target= running, config=snippet, test_option= test-then-set ) if name == main : demo(sys.argv[1], os.getenv("user"), sys.argv[2], sys.argv[3], sys.argv[4]) 18 / 1

! /usr/bin/env python2.6 Delete an existing user from the running configuration using edit-config and the test-option provided by the :validate capability. $./nc05.py broccoli bob import sys, os, warnings warnings.simplefilter("ignore", DeprecationWarning) from ncclient import manager def demo(host, user, name): snippet = """<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0"> <aaa xmlns="http://tail-f.com/ns/aaa/1.1"> <authentication> <users> <user xc:operation="delete"> <name>%s</name> </user></users></authentication></aaa></config>""" % name with manager.connect(host=host, port=22, username=user) as m: assert(":validate" in m.server_capabilities) m.edit_config(target= running, config=snippet, test_option= test-then-set ) if name == main : demo(sys.argv[1], os.getenv("user"), sys.argv[2]) 19 / 1

! /usr/bin/env python2.6 Delete a list of existing users from the running configuration using edit-config; protect the transaction using a lock. $./nc06.py broccoli bob alice import sys, os, warnings warnings.simplefilter("ignore", DeprecationWarning) from ncclient import manager template = """<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0"> <aaa xmlns="http://tail-f.com/ns/aaa/1.1"> <authentication> <users> <user xc:operation="delete"> <name>%s</name> </user></users></authentication></aaa></config>""" def demo(host, user, names): with manager.connect(host=host, port=22, username=user) as m: with m.locked(target= running ): for n in names: m.edit_config(target= running, config=template % n) if name == main : demo(sys.argv[1], os.getenv("user"), sys.argv[2:]) 20 / 1

! /usr/bin/env python2.6 Delete a list of existing users from the running configuration using edit-config and the candidate datastore protected by a lock. $./nc07.py broccoli bob alice import sys, os, warnings warnings.simplefilter("ignore", DeprecationWarning) from ncclient import manager template = """<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0"> <aaa xmlns="http://tail-f.com/ns/aaa/1.1"> <authentication> <users> <user xc:operation="delete"> <name>%s</name> </user></users></authentication></aaa></config>""" def demo(host, user, names): with manager.connect(host=host, port=22, username=user) as m: assert(":candidate" in m.server_capabilities) m.discard_changes() with m.locked(target= candidate ): for n in names: m.edit_config(target= candidate, config=template % n) m.commit() if name == main : demo(sys.argv[1], os.getenv("user"), sys.argv[2:]) 21 / 1

Conclusions 22 / 1

Conclusions Recommendations Stop hacking nasty expect scripts or the like. Use Python and NCClient it is cool and fun. Student assignments utilizing NCClient are a nice idea. If you use NCClient, please cite our IPOM 2009 paper. ;-) Future Work Support for recent protocol extensions (e.g., fine grained locking, data model retrieval) High-level API supporting network-wide operations Generate RPC stub classes from YANG data models... 23 / 1

References R. Enns. NETCONF Configuration Protocol. RFC 4741, Juniper Networks, December 2006. M. Wasserman and T. Goddard. Using the NETCONF Configuration Protocol over Secure SHell (SSH). RFC 4742, ThingMagic, ICEsoft Technologies, December 2006. H. M. Tran, I. Tumar, and J. Schönwälder. NETCONF Interoperability Testing. In Proc. of the 3rd International Conference on Autonomous Infrastructure, Management and Security (AIMS 2009), number 5637 in LNCS, pages 83 94. Springer, June 2009. S. Bhushan, H. M. Tran, and J. Schönwälder. NCClient: A Python Library for NETCONF Clients. In Proc. IPOM 2009, number 5843 in LNCS, Venice, October 2009. Springer. 24 / 1