Lua model » Historial » Versió 11
Pau Escrich, 25-07-2012 14:48
1 | 9 | Joel Espunya | h1. qMp reference (GSoC) |
---|---|---|---|
2 | 1 | Pau Escrich | |
3 | 7 | Joel Espunya | h2. model [Use qmp.debug] |
4 | 2 | Pau Escrich | |
5 | 5 | Joel Espunya | --- Get a section type or an option |
6 | -- @param section UCI section name |
||
7 | -- @param option UCI option (optional) |
||
8 | -- @return UCI value |
||
9 | *get(section, option)* |
||
10 | 1 | Pau Escrich | |
11 | 5 | Joel Espunya | --- Create a new section and initialize it with data. |
12 | -- @param type UCI section type |
||
13 | -- @param name UCI section name (optional) |
||
14 | -- @param values Table of key - value pairs to initialize the section with (optional) |
||
15 | -- @return Name of created section |
||
16 | *add(type, name, values)* |
||
17 | 1 | Pau Escrich | |
18 | 5 | Joel Espunya | --- Create a new anonymous section and initialize it with data. |
19 | -- @param type UCI section type |
||
20 | -- @param values Table of key - value pairs to initialize the section with (optional) |
||
21 | -- @return Name of created section |
||
22 | *add_type(type, values)* |
||
23 | 1 | Pau Escrich | |
24 | 5 | Joel Espunya | --- Deletes a section or an option. |
25 | -- @param section UCI section name |
||
26 | -- @param option UCI option (optional) |
||
27 | -- @return Boolean whether operation succeeded |
||
28 | *delete(section, option)* |
||
29 | 1 | Pau Escrich | |
30 | 5 | Joel Espunya | --- Deletes all the UCI sections of a given type |
31 | -- @param type UCI section type |
||
32 | -- @return Boolean whether operation succeeded |
||
33 | *delete_type(type)* |
||
34 | 1 | Pau Escrich | |
35 | 5 | Joel Espunya | --- Set a value or create a named section. |
36 | -- @param section UCI section name |
||
37 | -- @param option UCI option or UCI section type |
||
38 | -- @param value UCI value or nil if you want to create a section |
||
39 | -- @return Boolean whether operation succeeded |
||
40 | *set(section, option, value)* |
||
41 | |||
42 | --- Set given values as list. |
||
43 | -- @param section UCI section name |
||
44 | -- @param option UCI option |
||
45 | -- @param value UCI value |
||
46 | -- @return Boolean whether operation succeeded |
||
47 | *set_list(section, option, value)* |
||
48 | |||
49 | --- Get a table with the information of some sections of a given type |
||
50 | -- @param type UCI section type |
||
51 | -- @param index UCI section type index (optional) |
||
52 | -- @param option UCI option (optional) |
||
53 | -- @return Table or UCI value |
||
54 | *get_type(type, index, option)* |
||
55 | |||
56 | --- Get a table with all the sections of a given type |
||
57 | -- @param type UCI section type |
||
58 | -- @return Table |
||
59 | *get_all_type(type)* |
||
60 | |||
61 | --- Get a table with the information of the section of a given type and index |
||
62 | -- @param type UCI section type |
||
63 | -- @param index UCI section type index |
||
64 | -- @return Table |
||
65 | *get_type_index(type, index)* |
||
66 | |||
67 | --- Get an option of the section of a given type and index |
||
68 | -- @param type UCI section type |
||
69 | -- @param index UCI section type index |
||
70 | -- @param option UCI option |
||
71 | -- @return UCI value |
||
72 | *get_type_option(type, index, option)* |
||
73 | |||
74 | --- Commit the changed done with a UCI-Cursor |
||
75 | -- @param c UCI-Cursor |
||
76 | -- @return Boolean whether operation succeeded |
||
77 | *commit(c)* |
||
78 | |||
79 | --- Create a new UCI-Cursor |
||
80 | -- @return UCI-Cursor or an error on failure |
||
81 | *raw()* |
||
82 | |||
83 | --- Applies UCI configuration changes |
||
84 | -- @param cmd Don't apply only return the command |
||
85 | *apply(cmd)* |
||
86 | |||
87 | 6 | Joel Espunya | h2. bgp [Use qmp.model] |
88 | |||
89 | --- Get the published networks of the current node |
||
90 | -- @return table |
||
91 | *get_networks()* |
||
92 | |||
93 | --- Get the devices working on bpg mode |
||
94 | -- @return UCI value |
||
95 | *get_devices()* |
||
96 | |||
97 | --- Add a BGP peer |
||
98 | -- @param as AS of the BGP peer |
||
99 | -- @param ip IP of the BGP peer |
||
100 | -- @param netmask Netmask of the BGP peer |
||
101 | -- @return Name of created section |
||
102 | *add_peer(as, ip, netmask)* |
||
103 | |||
104 | --- Set the devices working on BGP mode |
||
105 | -- @param devices Devices working on bgp mode (string) |
||
106 | -- @return Boolean whether operation succeeded |
||
107 | *set_device(devices)* |
||
108 | |||
109 | --- Add a network to being published by BGP |
||
110 | -- @param network network range to be published |
||
111 | -- @return Boolean whether operation succeeded |
||
112 | *add_network(network)* |
||
113 | |||
114 | --- Remove the current BGP configuration |
||
115 | *clear()* |
||
116 | |||
117 | --- Set the AS of the working node |
||
118 | -- @param as AS of the working node |
||
119 | -- @return Boolean whether operation succeeded |
||
120 | *set_as(as)* |
||
121 | |||
122 | --- Get the AS of the working node |
||
123 | -- @return AS of the working node |
||
124 | *get_as()* |
||
125 | |||
126 | 10 | Pau Escrich | h2. network [Use qmp.model] |
127 | |||
128 | *add_if(name,iface) ##proto=none |
||
129 | |||
130 | *add_br(name,ifaces) ##proto=none |
||
131 | |||
132 | *add_alias(name,viface) ##proto=none |
||
133 | |||
134 | *set_ipv4(name,ip,mask) ##proto=static |
||
135 | |||
136 | *set_ipv6(name,network ##proto=static |
||
137 | |||
138 | *set_dhcp(name) ##proto=dhcp |
||
139 | |||
140 | *set_dns(dns) ##defined in loopback |
||
141 | |||
142 | *add_route4(name,viface,ipdest,netmask,gw) ##(guifi,backbone1,10.0.0.0,255.0.0.0,172.77.11.1) |
||
143 | |||
144 | *add_route6(...) |
||
145 | |||
146 | 11 | Pau Escrich | *add_iptun(...) |
147 | |||
148 | 6 | Joel Espunya | h2. control [Use qmp.model and qmpl.bgp] |
149 | 5 | Joel Espunya | |
150 | 3 | Joel Espunya | --- Remove the current bgp configuration |
151 | 1 | Pau Escrich | *remove_bgp_config()* |
152 | 3 | Joel Espunya | |
153 | --- Add a bgp peer |
||
154 | -- @param as AS of the BGP peer (if doesn't exist, it should be given as an argument) |
||
155 | -- @param ip IP of the BGP peer (if doesn't exist, it should be given as an argument) |
||
156 | -- @param netmask Netmask of the BGP peer (if doesn't exist, it should be given as an argument) |
||
157 | -- @return Boolean whether operation succeeded |
||
158 | 1 | Pau Escrich | *add_bgp_peer(as, ipdest, netmask)* |
159 | 3 | Joel Espunya | |
160 | --- Add a network to being published by bgp |
||
161 | -- @param network network range to be published (if doesn't exist, it should be given as an argument) |
||
162 | -- @return Boolean whether operation succeeded |
||
163 | 1 | Pau Escrich | *add_bgp_network(range)* |
164 | |||
165 | 3 | Joel Espunya | |
166 | --- Set the devices working on bpg mode |
||
167 | -- @param devices Devices working on bgp mode (if doesn't exist, it should be given as an argument) |
||
168 | -- @return Boolean whether operation succeeded |
||
169 | 1 | Pau Escrich | *set_bgp_devices(devices)* |
170 | 3 | Joel Espunya | |
171 | --- Set the AS of the working node |
||
172 | -- @param as AS of the working node (if doesn't exist, it should be given as an argument) |
||
173 | -- @return Boolean whether operation succeeded |
||
174 | 1 | Pau Escrich | *set_bgp_as(as)* |
175 | 3 | Joel Espunya | |
176 | --- Applies UCI configuration changes |
||
177 | 1 | Pau Escrich | *apply_changes()* |
178 | 7 | Joel Espunya | |
179 | h2. debug |
||
180 | |||
181 | --- Add one line to the system log file with the tag qMp |
||
182 | -- @param msg string |
||
183 | *logger(msg)* |
||
184 | 1 | Pau Escrich | |
185 | 3 | Joel Espunya | |
186 | h2. more information |
||
187 | 1 | Pau Escrich | |
188 | http://wiki.openwrt.org/doc/techref/uci |
||
189 | http://luci.subsignal.org/api/luci |