Download Shareware and Freeware Software for Windows, Linux, Macintosh, PDA

line Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

Serving Software Downloads in 976 Categories, Downloaded 29.892.055 Times

ciscoconfparse 0.8.2

Company: David Michael Pennington
Date Added: September 26, 2013  |  Visits: 273

ciscoconfparse

Report Broken Link
Printer Friendly Version


Product Homepage
Download (16 downloads)



ciscoconfparse is a Python library for parsing through Cisco IOS-style configurations and retrieving portions of the config based on a variety of query methods.<br /><br />The package will process an IOS-style config and break it into a set of linked parent / child relationships. Then you issue queries against these relationships using a familiar family syntax model. Queries can either be in the form of a simple string, or you can use regular expressions. The API provides powerful query tools, including the ability to find all parents that have or do not have children matching a certain criteria. This means it is easy to find the interface names of all layer2 trunks in a Catalyst 6500, or retrieve a list of all interfaces with cdp disabled. Until this package, I know of no simple config-parsing APIs to do the same; it has traditionally been considered the domain of screen-scraping. In conjunction with python's sophisticated set-manipulation capabilities, your imagination is the limit.<br /><br />The package also provides a set of methods to query and manipulate the IOSConfigLine objects themselves. This gives you a flexible mechanism to build your own custom queries, because the IOSConfigLine objects store all the parent / child hierarchy in them.<br /><br />Examples of config family relationships are shown below...<br /><br />Line01:policy-map QOS_1<br />Line02: class GOLD<br />Line03: priority percent 10<br />Line04: class SILVER<br />Line05: bandwidth 30<br />Line06: random-detect<br />Line07: class default<br />Line08:!<br />Line09:interface Serial 1/0<br />Line10: encapsulation ppp<br />Line11: ip address 1.1.1.1 255.255.255.252<br />Line12:!<br />Line13:access-list 101 deny tcp any any eq 25 log<br />Line14:access-list 101 permit ip any any<br /> <br />parents: 01, 02, 04, 09<br />children: of 01 = 02, 04, 07<br />of 02 = 03<br />of 04 = 05, 06<br />of 09 = 10, 11<br />siblings: 02, 04, 07<br />05, 06<br />10, 11<br />oldest_ancestors: 01, 09<br />families: 01, 02, 03, 04, 05, 06, 07<br />09, 10, 11<br />family_endpoints: 07, 11<br /><br />Note that 01, 09, 13 and 14 are not considered siblings, nor are they part of the same family. In fact, 13 and 14 do not belong to a family at all; they have no children.<br /><br />The package provides several types of methods:<br /><br />1. Query methods returning a list of text lines.<br />1.1 find_lines( self, linespec, exactmatch=False, ignore_ws=False ):<br />1.2 find_children( self, linespec, exactmatch=False, ignore_ws=False ):<br />1.3 find_all_children( self, linespec, exactmatch=False, ignore_ws=False ):<br />1.4 find_blocks( self, blockspec, exactmatch=False, ignore_ws=False ):<br />1.5 find_parents_w_child( self, parentspec, childspec, ignore_ws=False ):<br />1.6 find_parents_wo_child( self, parentspec, childspec, ignore_ws=False ):<br />1.7 req_cfgspec_all_diff( self, cfgspec ):<br />1.8 req_cfgspec_excl_diff( self, linespec, uncfgspec, cfgspec ):<br /><br />2. Query methods returning a list of IOSConfigLine objects.<br />2.1 find_line_OBJ( self, linespec ):<br />2.2 find_sibling_OBJ( self, lineobject ):<br />2.3 find_child_OBJ( self, lineobject):<br />2.4 find_all_child_OBJ( self, lineobject ):<br />2.5 find_parent_OBJ( self, lineobject ):<br /><br />3. Methods for manipulating IOSConfigLine objects<br />3.1 unique_OBJ( self, objectlist ):<br />3.2 objects_to_lines( self, objectlist ):<br />3.3 objects_to_uncfg( self, objectlist, unconflist ):<br /><br />4. Query methods on IOSConfigLine objects<br />4.1 parent(self):<br />4.2 children(self):<br />4.3 has_children(self):<br />4.4 child_indent(self):<br />4.5 oldest_ancestor(self):<br />4.6 family_endpoint(self):<br />4.7 linenum(self):<br />4.8 text(self):<br />4.9 uncfgtext(self):<br /><br />5. Methods for parsing the configuration: I won't bother explaining here...<br />You have the source if you are interested.<br /><br />BASIC USAGE<br /><br />#!/usr/bin/env python<br />from ciscoconfparse import *<br /> <br />parse = CiscoConfParse("/tftpboot/bucksnort.conf")<br /> <br /># Return a list of all ATM interfaces and subinterfaces<br />#<br />atm_intfs = parse.find_lines("^interfacesATM")<br /> <br /># Return a list of all interfaces with a certain QOS policy<br />#<br />qos_intfs = parse.find_parents_w_child( "^interf", "service-policy QOS_01" )<br /> <br /># Return a list of all active interfaces (i.e. not shutdown)<br />#<br />active_intfs = parse.find_parents_wo_child( "^interf", "shutdown" )<br /> <br /># Find all interfaces that have voice configured, if they are trusting dscp<br /># build a new config to trust cos<br />#<br /># You must put a caret (^) sign in front of "interface" below... otherwise you will get matches<br /># for any command with interface in the syntax. ^ is a regular expression to match the beginning<br /># of a line.<br />#<br />newcfg = []<br />voice_intfs = parse.find_parents_w_child("^interface", "switchport voice")<br />for intf in voice_intfs:<br /> famobj = CiscoConfParse( parse.find_children( intf, exactmatch = True ) )<br /> if( famobj.find_lines("mls qos trust dscp") ):<br /> newcfg.append(intf)<br /> newcfg.append(" mls qos trust cos")<br /><br />The examples/ directory in the distribution contains more usage cases, including sample configs to parse. When enforcing configuration standards, the req_cfgspec_excl_diff() method is very useful; examples of its usage are included.<br /><br />md5=ae82d6693ba38f91df7f8d7c85f79c26

Requirements: No special requirements
Platforms: *nix, Linux
Keyword: Ciscoconfparse 0 8 2 Class Config Exactmatch Dfalse Family Ignore Dfalse Interfaces Iosconfigline Lineobject Linespec Methods Objectlist Package Query Regular Relationships Return Trust
Users rating: 0/10

License: Freeware Size: 30.72 KB
USER REVIEWS
More Reviews or Write Review


CISCOCONFPARSE RELATED
Libraries  -  libdbi-drivers 0.8.2-1
libdbi implements a database-independent abstraction layer in C, similar to the DBI/DBD layer in Perl. Writing one generic set of code, programmers can leverage the power of multiple databases and multiple simultaneous database connections by...
952.32 KB  
Finance  -  GFP 0.7.2 / 0.8.0 RC2
GFP is a Java/Swing personal finance manager that is translated to 7 languages and is being translated to more. GFP It supports credit card, bank, and savings accounts, and is easy to use. GFP – Personal Finance Manager – is a...
1.7 MB  
Libraries  -  libtiff 3.8.2 / 3.9.0 Beta
libtiff library provides support for the Tag Image File Format (TIFF), a widely used format for storing image data. The latest version of the TIFF specification is available on-line in several different formats, as are a number of TIFF Technical...
1.2 MB  
Backup Utilities  -  SystemImager 3.8.2 / 3.9.2
SystemImager is software that automates Linux installs, software distribution, and production deployment. SystemImager makes it easy to do automated installs (clones), software distribution, content or data distribution, configuration changes,...
 
Code Management Tools  -  re2c 0.12.2 / 0.13.0
re2c is a tool for writing flexible and fast lexers. Unlike other such tools, it concentrates solely on generating efficient code for matching regular expressions. This make it suitable for a wide variety of applications. The generated scanners...
122.88 KB  
Programming  -  Sh 0.8.0 RC1
Sh is a programming language built on top of C++. It can be used to write shaders that run on top of modern graphics processing units (GPUs), or write stream programs that run on GPUs or CPUs. Sh project is implemented as a C++ library, and...
378.88 KB  
Network & Internet  -  Selenium Core 0.8.2
Selenium Core is a test tool for web applications. Selenium Core tests run directly in a browser, just as real users do. And they run in Internet Explorer, Mozilla and Firefox on Windows, Linux, and Macintosh. No other test tool covers such a wide...
522.24 KB  
Libraries  -  libundo 0.8.2
Libundo is a simple, easy-to-use library which manages recording and playback of undo/redo information for application developers. It is designed to be simple to plug in to existing applications and require only a minimal amount of support code...
204.8 KB  
E-Mail Tools  -  Enterprise CRM and Groupware System 1.2.8/2.0 Beta 1
Enterprise CRM and Groupware System is a PHP/PostgreSQL system. Enterprise CRM and Groupware System offers multi-layered access to data and the following features: advanced CRM (similar to XRMS), project management tools, email ticketing, Web...
4.4 MB  
Libraries  -  JPOX 1.1.8 / 1.2.0 Beta 3
JPOX is a free and fully compliant implementation of the JDO 1.0 and 2.0 specifications, providing transparent persistence of Java objects. JPOX supports persistence to all of the major RDBMS on the market today, supporting all of the main...
1.6 MB  
NEW DOWNLOADS IN LINUX SOFTWARE, PROGRAMMING
Linux Software  -  Polling Autodialer Software 3.4
ICTBroadcast Auto Dialer software has a survey campaign for telephone surveys and polls. This auto dialer software automatically dials a list of numbers and asks them a set of questions that they can respond to, by using their telephone keypad....
488 B  
Linux Software  -  Total Video Converter Mac Free 3.5.5
Total Video Converter Mac Free developed by EffectMatrix Ltd is the official legal version of Total Video Converter which was a globally recognized brand since 2006. Total Video Converter Mac Free is a free but powerful all-in-one video...
17.7 MB  
Linux Software  -  Skeith mod_log_sql Analyzer 2.10beta2
Skeith is a php based front end for analyzing logs for Apache using mod_log_sql.
47.5 KB  
Linux Software  -  SLAX 6.0+
Slax is a modern, portable, small and fast Linux operating system with a modular approach and outstanding design. Despite its small size, Slax provides a wide collection of pre-installed software for daily use, including a well organized graphical...
190 KB  
Linux Software  -  GTK+ 2.5
GTK+, which stands for the GIMP Toolkit, is a library for creating graphical user interfaces for the X Window System. It is designed to be small, efficient, and flexible. GTK+ is written in C with a very object-oriented approach. Language bindings...
60 MB  
Programming  -  FLEX-db Digital Asset Manager 3.0.9
FLEX-db - an enterprise Digital Asset Manager (DAM). It ingests and links metadata with files, creates thumbnails, and processes files using business rules. FLEX-db has a JSP client, Java app server for file input and output and an EJB metadata...
21.57 MB  
Programming  -  Libicom 0.9.0
The libicom library is a character based dynamicly linked library for Linux. It is used to remotely control the Icom IC-R8500 wide band receiver via an RS232 link. All call and return parameters to the control functions are character string based....
20.48 KB  
Programming  -  dotdesktop 0.3
Dotdesktop library provides ability to parse desktop entry file and access the information in a convenient way. Desktop entry file format is defined by freedesktop.org, it is used to describe information about an application such as the name and...
327.68 KB  
Programming  -  Cedalion for Linux 0.2.6
Cedalion is a programming language that allows its users to add new abstractions and define (and use) internal DSLs. Its innovation is in the fact that it uses projectional editing to allow the new abstractions to have no syntactic limitations.
471.04 KB  
Programming  -  libyasl 0.2
Libyasl is a C++ class library to easily realize TCP/UDP/Multicast clientsand servers in IPv4 and IPv6 environments under GNU/Linux systems.
143.36 KB