The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

ncp

VERSION

version 0.002

SYNOPSIS

./ncp [options] [file1 file2 ...]

    -v, --vendor=STRING vendor type

    -t, --type=STRING type of vendor device

    -f, --format=STRING format of the output configuration, defaults to raw Perl.

    -o, --output=STRING file to write to, defaults to STDOUT.

    Type 'man ncp' for more information.

NAME

ncp - parse network device configurations.

OPTIONS

-v|--vendor <string>

Specfies the vendor of the configuration to be parsed - e.g. 'CheckPoint', 'Cisco'. This is combined with the '--type' command line argument to load the appropriate parser.

-t|--type <string>

Specifies the type of vendor device the configuration is for - e.g. 'Gaia', 'ASA'. This is combined with the '--vendor' command line argument to load the appropriate parser.

-f|--format <string>

Specify the format of the output parsed configuration. The 'raw' type is always available, and this will output the raw Perl structures. This is the default if no format is specified.

Other types available are dependent on the parser module loaded. Examples may incude 'json' for JavaScript Object Notation and 'csv' for comma separated values.

-o|--output <string>

Specifies the file to write the output to. The content of the file is parser module dependent.

If not specified (or the special file '-' is used) it defaults to STDOUT. The file is opened in append mode, so the current contents will not be clobbered.

The special variable %in_file% contains the input config filename and can be used to split the output when multiple input files are used, for example:

    ncp --vendor Cisco --type ASA --type raw --output converted_%in_file% file1.conf file2.conf

would output 'converted_file1.conf' and 'converted_file2.conf'. On the other hand:

    ncp --vendor Cisco --type ASA --type raw --output converted.conf file1.conf file2.conf

would output a single 'converted.conf' containing the output from both file1.conf and file2.conf.

[file1 file2 ...]

A list of configuration files to parse. If no configuration files are listed it reads from STDIN until EOF (Ctrl + D). When reading from STDIN, the %in_file% variable used in --output is 'STDIN'.

Examples

    # Use the CheckPoint::Gaia module parse a configuration file and output Perl format to STDOUT
    ncp checkpoint_gaia.conf
    
    # Use the Cisco::ASA module to parse the configuration to JSON 
    ncp --vendor Cisco --type ASA --format json --output asa.conf


    # Use the Cisco::ASA module to parse the configuration of three config files, outputting JSON
    # to three separate output files
    ncp --vendor Cisco --type ASA --format csv --output %in_file%.csv fw1.conf fw2.conf fw3.conf

AUTHOR

Greg Foletta <greg@foletta.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Greg Foletta.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.