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.
- RunCommand(*INPUT, *OUTPUT, command)
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:
- ProcessHistory([tag], [sort_function], [sort_function_argument], string)
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:
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.
A numerical sort routine (ascending).
- ipsort(IPv4 dotted-quad/v6 address)
A sort routine that will sort on the ip address when the IP address is anywhere in the strings.
A sort routine that will sort based upon IPv4/v6 addresses.
Please see the library code for exported variables.
Please see the pydoc(1) for documentation on the rancid Python module. It is equivalent to the Perl module, but in a Pythonic manner.