1rancid(3) Library Functions Manual rancid(3)
2
3
4
6 rancid - rancid Perl and Python modules
7
9 The rancid library provides functions for handling rancid.types
10 configuration files, loading modules, and the basic global variables,
11 variables from parsing rancid.types files, and output handling
12 functions that are common to all rancid device modules, all of which
13 are exported (in Perl terms) for use by those that import the module.
14 Specifically, the library is used by rancid(1), but it could be used by
15 any Perl program for site-specific handling or additional automata.
16
17 RunCommand(*INPUT, *OUTPUT, command)
18 Parse a single command that returns no required info; the output
19 is dropped. This could be used as the processing function in a
20 command definition in a rancid.types file.
21
22 Output handling functions:
23
24
25 ProcessHistory([tag], [sort_function], [sort_function_argument],
26 string)
27 If the optional tag string and sort_function arguments are
28 omitted, the string is output immediately. Otherwise, the
29 strings are accumulated in a hash, by the hash key
30 sort_function_argument, each time ProcessHistory() is called
31 until the tag or sort_function changes, at which time the queue
32 is flushed and the new string is handled. If sort_function had
33 been supplied, it is called with the hash as its argument.
34
35 Note that if the hash key sort_function_argument exists, the new
36 strings is appended to the existing hash value.
37
38 keysort(%hash)
39 A sort routine that will sort on the keys of a hash as if it
40 were a normal array. For example:
41
42 ProcessHistory("TAG","keysort","B0","!\n");
43 ProcessHistory("TAG","keysort","D0","!\n");
44
45 B0 and D0 are the sort keys.
46
47 valsort(%hash)
48 A sort routine that will sort on the values of a hash as if it
49 were a normal array.
50
51 ProcessHistory("TAG","valsort","","!B0\n");
52 ProcessHistory("TAG","valsort","","!D0\n");
53
54 numsort(%hash)
55 A numerical sort routine (ascending).
56
57 ipsort(IPv4 dotted-quad/v6 address)
58 A sort routine that will sort on the ip address when the IP
59 address is anywhere in the strings.
60
61 ProcessHistory("TAG","ipsort","192.168.0.0","!B0\n");
62 ProcessHistory("TAG","ipsort","192.168.1.0","!D0\n");
63
64 sortbyipaddr(XXX)
65 A sort routine that will sort based upon IPv4/v6 addresses.
66
67 Please see the library code for exported variables.
68
69 Please see the pydoc(1) for documentation on the rancid Python module.
70 It is equivalent to the Perl module, but in a Pythonic manner.
71
73 rancid(1), rancid.types.conf(5)
74
75
76
77 15 April 2019 rancid(3)