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

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

Serving Software Downloads in 956 Categories, Downloaded 50.323.288 Times

ciscoconfparse 0.8.2

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

ciscoconfparse

Report Broken Link
Printer Friendly Version


Product Homepage
Download (39 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
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 software...
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  
Benchmark Tools  -  ProcBench 0.8.2 Alpha 0.8.2 Alpha
Procbench is a multiplatform information tool and CPU benchmark for x86 processors. This application tests memory transfer and math capabilities of your x86 processor. Here are some key features of "ProcBench": A*A*...
61.44 KB  
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  
Modules  -  netFORUM Views 5.x-0.8-2 1.0
It also offers some help building the list queries. There is also limited support for allowing HTTP POST and GET arguments as special fields, which can be used to create simple directories.InstallationUnpack in your modules folder (usually...
 
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  
Utilities  -  ebtables 2.0.8 rc2
ebtables is a filtering tool for a bridging firewall. A firewalling tool to transparently filter network traffic passing a bridge. The filtering possibilities are limited to link layer filtering and some basic filtering on higher network layers....
93.18 KB  
NEW DOWNLOADS IN LINUX SOFTWARE, PROGRAMMING
Linux Software  -  EasyEDA PCB Designer for Linux 2.0.0
EasyEDA, a great web based EDA(Electronics Design Automation) tool, online PCB tool, online PCB software for electronics engineers, educators, students, makers and enthusiasts. Theres no need to install any software. Just open EasyEDA in any...
34.4 MB  
Linux Software  -  wpCache® WordPress HTTP Cache 1.9
wpCache® is a high-performance, distributed object, caching system application, generic in nature, but intended for use in speeding up dynamic web applications, by decreasing database load time. wpCache® decreases dramatically the page...
3.51 MB  
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  
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  -  Math::GMPf 0.29
Math::GMPf - perl interface to the GMP library's floating point (mpf) functions.
30.72 KB  
Programming  -  Net::Wire10 1.08
Net::Wire10 is a Pure Perl connector that talks to Sphinx, MySQL and Drizzle servers. Net::Wire10 implements the low-level network protocol, alias the MySQL wire protocol version 10, necessary for talking to one of the aforementioned...
30.72 KB  
Programming  -  logilab-common 0.56.2
a bunch of modules providing low level functionnalities shared among some python projects devel Please note that some of the modules have some extra dependencies. For instance, logilab.common.db will require a db-api 2.0 compliant...
174.08 KB  
Programming  -  OpenSSL for linux 1.0.0a
The OpenSSL Project is a collaborative effort to develop a robust, commercial-grade, full-featured, and Open Source toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols as well as a...
3.83 MB