Skip to content

Parse, Audit, Query, Build, and Modify Cisco IOS-style configurations. Python Infrastructure as Code (IaC) for Cisco IOS (and other vendors).

License

Notifications You must be signed in to change notification settings

SCadilhac/ciscoconfparse

 
 

Repository files navigation

Fork of ciscoconfparse without DNS resolver to work with GraalVM.

To be used in Netshot 0.16.2+ and GraalVM 21.3.0.

su - netshot -s /bin/bash
cd /usr/local/netshot
mkdir python && cd python
graalpython -m venv venv
source venv/bin/activate
/usr/local/netshot/python/venv/bin/graalpython -m pip install --upgrade pip
pip3 install loguru
pip3 install git+https://github.com/SCadilhac/ciscoconfparse

Add the following line to netshot.conf:

netshot.python.virtualenv = /usr/local/netshot/python/venv

In your compliance script, you can import the installed package:

import site
from ciscoconfparse import CiscoConfParse

# Script template - to be customized
def check(device):
  ## Grab some data:
  config = device.get('running_config')
  parse = CiscoConfParse(config.splitlines(), syntax='ios')
  for intf_obj in parse.find_objects_w_child('^interface', '^\s+shutdown'):
    debug(intf_obj.text + " is shutdown")

About

Parse, Audit, Query, Build, and Modify Cisco IOS-style configurations. Python Infrastructure as Code (IaC) for Cisco IOS (and other vendors).

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 98.7%
  • Makefile 1.1%
  • Other 0.2%