Giter Club home page Giter Club logo

bracematch's Introduction

bracematch

Overview

A tool for quick-n-dirty minimal validation of formatting of Juniper-style configurations, as well as translating config files into "set" statements. Juniper, PaloAlto, Vyatta, and other similar nested formats should work.

This is a simple tool to verify that opening and closing braces match in Juniper-style configurations. Key features are:

  • checking brace matching
  • reindenting
  • displaying current header context per-line
  • convert full config format to "set" statements

I find it useful for checking configuration sections offline prior to 'load merge', as well as for validating output of other configuration-management tools.

Usage

Syntax Validation

The original use case for bracematch was validation that template-generated device configurations didn't have any glaring syntax errors, and to help track down where problems such as a mismatched closing bracket for a section occurred.

Examples:

cat myrouter.conf | bracematch -q && echo OK

cat myrouter.conf | bracematch

Convert Native Configuration to "set" Commands

This turns out to be really useful - one downside of the native JunOS-style syntax is that simply grepping for an item won't provide the context to tell where the item of interest is used. Or for platforms like Palo Alto that don't have an easy "load merge" equivalent, this allows you to easily restore via CLI from a backup, or otherwise duplicate/alter configs.

Example:

$ cat <<EOF | bracematch -s
> system {
>     host-name myrouter;
> }
> EOF
set system host-name myrouter

Comments via Juniper "annotate" are attempted to be preserved, but this feature is still considered experimental, as not all contexts can be easily identified.

bracematch's People

Contributors

ermuller avatar

Stargazers

 avatar Ryan Gelobter avatar Logan V avatar  avatar Erik Jarrett avatar Dan Houtz avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.