table of contents
other versions
- jessie-backports 3.6.2-2~bpo8+1
- stretch 3.6.2-2
- testing 3.8-5
- stretch-backports 3.8-5~bpo9+1
- unstable 3.9-1
other sections
rancid(3) | Library Functions Manual | rancid(3) |
NAME¶
rancid - rancid perl moduleINTRODUCTION¶
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.
- 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.
- keysort(%hash)
- 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.
- valsort(%hash)
- 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");
- numsort(%hash)
- 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.
ProcessHistory("TAG","ipsort","192.168.0.0","!B0\n"); ProcessHistory("TAG","ipsort","192.168.1.0","!D0\n");
- sortbyipaddr(XXX)
- A sort routine that will sort based upon IPv4/v6 addresses.
SEE ALSO¶
rancid(1), rancid.types.conf(5)23 May 2016 |