-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Junos-style configs searchable #17
Comments
We now parse Junos configurations into Cisco IOS-style (I already hear the distant cries of "heretic")... nevertheless, if you want to see it in action, here's how I parse
This is a hack, to be sure... so I'm leaving the enhancement open until I get a few more details nailed down... in the mean time, if people want to experiment with searching Junos as IOS, it is here :-) |
Junos Searches with
|
Hi Mike I am trying to parse the F5 Networks configurations. Do you have a syntax ready for bigIP or any timeplan :)
Running the code like
|
@kthned, "} else {" should parse correctly in the latest versions... please let me know if you run into problems |
Another junos-parsing example using Suppose you want to associate junos interface names with their IP addresses from this example config...
from ciscoconfparse import CiscoConfParse
parse = CiscoConfParse(config, syntax='junos', comment='#')
branchspec = (
r'interfaces',
r'^\s+\S+', # Detect any intf name...
r'^\s+unit',
r'^\s+family',
r'^\s+address',
)
for params in parse.find_object_branches(branchspec):
# Select the params with the corresponding index of the regex specified in branchspec, above...
intf_obj, intf_family_obj, addr_obj = params[1], params[3], params[4]
intf_name = intf_obj.re_match_typed('^\s+(\S+)')
intf_family = intf_family_obj.re_match_typed('\s+family\s+(inet\S*)')
addr = addr_obj.re_match_typed('^\s+address\s+(\S+)')
print("{} {} {}".format(intf_name, intf_family, addr)) When you run the script above, you will get this as output...
|
Some people want ciscoconfparse to search Junos configurations... this bug tracks implementation of the feature request.
The text was updated successfully, but these errors were encountered: