Projecte

General

Perfil

Lua model » Historial » Versió 8

Joel Espunya, 25-06-2012 22:10

1 8 Joel Espunya
h1. qMp reference
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
h2. control [Use qmp.model and qmpl.bgp]
127 5 Joel Espunya
128 3 Joel Espunya
--- Remove the current bgp configuration 
129 1 Pau Escrich
*remove_bgp_config()*
130 3 Joel Espunya
131
--- Add a bgp peer 
132
-- @param as AS of the BGP peer (if doesn't exist, it should be given as an argument)
133
-- @param ip IP of the BGP peer  (if doesn't exist, it should be given as an argument)
134
-- @param netmask Netmask of the BGP peer  (if doesn't exist, it should be given as an argument)
135
-- @return	Boolean whether operation succeeded
136 1 Pau Escrich
*add_bgp_peer(as, ipdest, netmask)*
137 3 Joel Espunya
138
--- Add a network to being published by bgp
139
-- @param network network range to be published (if doesn't exist, it should be given as an argument)
140
-- @return Boolean whether operation succeeded
141 1 Pau Escrich
*add_bgp_network(range)*
142
143 3 Joel Espunya
144
--- Set the devices working on bpg mode
145
-- @param devices Devices working on bgp mode (if doesn't exist, it should be given as an argument)
146
-- @return	Boolean whether operation succeeded
147 1 Pau Escrich
*set_bgp_devices(devices)*
148 3 Joel Espunya
149
--- Set the AS of the working node
150
-- @param as AS of the working node (if doesn't exist, it should be given as an argument)
151
-- @return	Boolean whether operation succeeded
152 1 Pau Escrich
*set_bgp_as(as)*
153 3 Joel Espunya
154
--- Applies UCI configuration changes
155 1 Pau Escrich
*apply_changes()*
156 7 Joel Espunya
157
h2. debug
158
159
--- Add one line to the system log file with the tag qMp
160
-- @param msg	string
161
*logger(msg)*
162 1 Pau Escrich
163 3 Joel Espunya
164
h2. more information 
165 1 Pau Escrich
166
http://wiki.openwrt.org/doc/techref/uci
167
http://luci.subsignal.org/api/luci