Projecte

General

Perfil

Lua model » Historial » Versió 5

Joel Espunya, 25-06-2012 22:04

1 3 Joel Espunya
!!h1. Lua model
2 1 Pau Escrich
3
h2. model
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 3 Joel Espunya
h2. control
88 5 Joel Espunya
89 3 Joel Espunya
--- Remove the current bgp configuration 
90 1 Pau Escrich
*remove_bgp_config()*
91 3 Joel Espunya
92
--- Add a bgp peer 
93
-- @param as AS of the BGP peer (if doesn't exist, it should be given as an argument)
94
-- @param ip IP of the BGP peer  (if doesn't exist, it should be given as an argument)
95
-- @param netmask Netmask of the BGP peer  (if doesn't exist, it should be given as an argument)
96
-- @return	Boolean whether operation succeeded
97 1 Pau Escrich
*add_bgp_peer(as, ipdest, netmask)*
98 3 Joel Espunya
99
--- Add a network to being published by bgp
100
-- @param network network range to be published (if doesn't exist, it should be given as an argument)
101
-- @return Boolean whether operation succeeded
102 1 Pau Escrich
*add_bgp_network(range)*
103
104 3 Joel Espunya
105
--- Set the devices working on bpg mode
106
-- @param devices Devices working on bgp mode (if doesn't exist, it should be given as an argument)
107
-- @return	Boolean whether operation succeeded
108 1 Pau Escrich
*set_bgp_devices(devices)*
109 3 Joel Espunya
110
--- Set the AS of the working node
111
-- @param as AS of the working node (if doesn't exist, it should be given as an argument)
112
-- @return	Boolean whether operation succeeded
113 1 Pau Escrich
*set_bgp_as(as)*
114 3 Joel Espunya
115
--- Applies UCI configuration changes
116 1 Pau Escrich
*apply_changes()*
117
118 3 Joel Espunya
119
h2. more information 
120 1 Pau Escrich
121
http://wiki.openwrt.org/doc/techref/uci
122
http://luci.subsignal.org/api/luci