DOKK / manpages / debian 10 / rancid / rancid.3.en
rancid(3) Library Functions Manual rancid(3)

rancid - rancid perl module

The rancid library provides functions for handling rancid.types configuration files, loading modules, and the basic global variables, variables from parsing rancid.types files, and output handling functions that are common to all rancid device modules, all of which are "exported" (in perl terms) for use by those that import the module. Specifically, the library is used by rancid(1), but it could be used by any perl program for site-specific handling or additional automata.

Parse a single command that returns no required info; the output is dropped. This could be used as the processing function in a command definition in a rancid.types file.

Output handling functions:

If the optional tag string and sort_function arguments are omitted, the string is output immediately. Otherwise, the strings are accumulated in a hash, by the hash key sort_function_argument, each time ProcessHistory() is called until the tag or sort_function changes, at which time the queue is flushed and the new string is handled. If sort_function had been supplied, it is called with the hash as its argument.

Note that if the hash key sort_function_argument exists, the new strings is appended to the existing hash value.

A sort routine that will sort on the keys of a hash as if it were a normal array. For example:

ProcessHistory("TAG","keysort","B0","!\n");
ProcessHistory("TAG","keysort","D0","!\n");

B0 and D0 are the sort keys.

A sort routine that will sort on the values of a hash as if it were a normal array.

ProcessHistory("TAG","valsort","","!B0\n");
ProcessHistory("TAG","valsort","","!D0\n");
A numerical sort routine (ascending).
A sort routine that will sort on the ip address when the IP address is anywhere in the strings.

ProcessHistory("TAG","ipsort","192.168.0.0","!B0\n");
ProcessHistory("TAG","ipsort","192.168.1.0","!D0\n");
A sort routine that will sort based upon IPv4/v6 addresses.

Please see the library code for exported variables.

rancid(1), rancid.types.conf(5)

23 May 2016