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

NAME

ncp - parse network device configurations.

VERSION

version 0.006

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 'perldoc ncp' or 'man ncp' for more information.

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. If not supplied, 'Cisco' is assumed.

-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. If not supplied, 'ASA' is assumed.

-f|--format <string>

Specify the format of the output parsed configuration. The 'raw' & 'json' drivers are always availabler. The 'raw' driver dumps the Perl data structre, and the 'json' driver encodes this data structure as JSON. If not supplied, 'raw' is assumed.

Other output drivers available are dependent on the parser module loaded. For example a parser module may supply a 'csv' output driver to output the configuration as 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 Cisco::ASA module to parse the configuration to JSON 
    ncp --vendor Cisco --type ASA --format json --output asa.conf

    # As Cisco::ASA is the default, the above command could also be achieved with
    ncp --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