Questions tagged [ciscoconfparse]

Use this tag for questions relating to ciscoconfparse, a Python library which parses through Cisco IOS-style configurations.

ciscoconfparse is an application that can parse, audit, query, build and modify Cisco IOS configurations.

More information can be found at ciscoconfparse bitbucket and the ciscoconfparse documentation.

32 questions
2
votes
1 answer

How to describe scopes in EBNF?

I'm trying to write a parser for Cisco IOS and ASA configurations, using Grako and Python. I'm trying to figure out how to represent 'scoped' keywords in EBNF - for example, the 'description' keyword must appear inside an interface scope, but there…
AnotherHowie
  • 818
  • 1
  • 11
  • 28
2
votes
2 answers

Need help parsing Cisco output

I am having some issue trying to parse the mrib table of a router. I have been able to parse some of it out but having issue. For example I have the following output: (192.168.1.1,232.0.6.8) RPF nbr: 55.44.23.1 Flags: RPF Up: 4w1d Incoming…
2
votes
1 answer

Error message while running python script to parse IOS config files

I have been able to write a python script that parses IOS config files but I am getting an error. Below is the script: import glob, os from ciscoconfparse import CiscoConfParse os.chdir("T:/") for cfgfile in glob.glob("*-confg"): parse =…
Jason
  • 21
  • 1
1
vote
2 answers

Script to connect to multiple network devices and run commands against it's running configuration

I'm attempting to write a script that pulls ip addresses from a file, connect to a network device at that ip address, run a "show run" against the device, export that config to a temp file, then parse the file for certain commands. I'm trying to…
L. Shouse
  • 19
  • 2
1
vote
0 answers

sync_diff() unable to keep sequencing/order

Ultimately, I'm trying to diff out curly brace notation. Similar to a "show | compare" output in Junos. Unfortunately setting the syntax to 'junos' does not keep the curly braces in the output. However, setting it to 'ios' does. It seems to have…
1
vote
1 answer

CiscoConfigParser & Functions

I am trying to make the code cleaner and better manageable and i wanted to start with reading a cisco file. However when i try to put it in a function, it is not able to give me the outputs. The same works perfectly out of a function Working…
python_user
  • 55
  • 2
  • 6
1
vote
2 answers

config from router shows as one line need multiline for ciscoconfparse

Network guy that's new to Python and programming and found this ciscoconfparse library that looks to have some pretty useful features. I'm running into an issue that I'm sure is something basic, but haven't figured it out. I'm trying to pull snmp…
spurious1
  • 11
  • 1
1
vote
2 answers

How to fix "AttributeError: 'module' object has no attribute 'SOL_UDP'" error in Python Connector Mule

I'm trying to execute a basic script to return Cisco Config File as a JSON Format, and I have a success process over Python2.7.16 and Python 3.7.3, but when I'm trying to execute the same script over Python Connector for Mule ESB I receive the error…
Esteban
  • 71
  • 1
  • 9
1
vote
1 answer

Can I use two ciscoconfparse objects in a single Cisco IOS config file to get specific interfaces

Trying to use two of the conf objects find_objects_w_child & find_objects_wo_child in a single file. I need to find out "interfaces" from a Cisco config file which have a specific QoS "service-policy" command configured. At the same time should…
arbaz
  • 27
  • 7
1
vote
3 answers

Python - Read Specific Lines of Text

I'm trying to search files for specific text. Then print the line immediately prior to the line, and all subsequent lines that start with a specific character, particularly a 'space.' Here's a sample of the file I'm trying to read: interface vlan…
T.J.
  • 19
  • 5
1
vote
1 answer

python ciscoconfparse interface ips and their wan ips

I saved my sample configuration file below. I would like to parse interface details, like Interface name, Description, vlan-type, qos-policy, ip address and also want identify WAN ip pool through interface ip address. # interface Aux0/0/1 …
Anna Patil
  • 31
  • 3
1
vote
4 answers

Split a list on a key word which may appear multiple times

I've read the examples which seem similar but I am not at that level to understand the answers. I want to take the list output and write each interface as a separate line (aka list I write to a csv). I need to split the initial return list on the…
Seth
  • 103
  • 1
  • 2
  • 14
1
vote
2 answers

My dict appears to overwrite and not update with new rows?

Given the following code: https://bpaste.net/show/dd44a1fa01dc from ciscoconfparse import CiscoConfParse from pprint import pprint parse = CiscoConfParse("testconfig.txt", syntax="junos") interfaces = {} intfs =…
ddevalco
  • 1,209
  • 10
  • 20
1
vote
2 answers

using CiscoConfParse to find ACL applied to VTY and then check ACL for log statement

I have the code to find the name of the 'access-class' on the 'line vty' After that I am able to find the ACL but then I want to check each line of the ACL to verify that the 'deny' and 'permit' statements have the 'log' keyword. And print a report…
1
vote
1 answer

select a list of interfaces with Python CISCOCONFPARSE and regex

I use a double loop to select all interfaces GigabitEthernet1/0/1 to 1/0/16 and 2/0/1 to 2/0/16 using efficient tool CISCOCONFPARSE : here is the example, that works : CONFIG_PARSED = CiscoConfParse(CONFIG) for i in range(1,3): for j in…
bigstyx
  • 123
  • 1
  • 1
  • 6
1
2 3