Projecte

General

Perfil

Actions

Lua model » Historial » Revisió 5

« Anterior | Revisió 5/11 (diferencies) | Següent »
Joel Espunya, 25-06-2012 22:04


!!h1. Lua model

model

--- Get a section type or an option
-- @param section UCI section name
-- @param option UCI option (optional)
-- @return UCI value
get(section, option)

--- Create a new section and initialize it with data.
-- @param type UCI section type
-- @param name UCI section name (optional)
-- @param values Table of key - value pairs to initialize the section with (optional)
-- @return Name of created section
add(type, name, values)

--- Create a new anonymous section and initialize it with data.
-- @param type UCI section type
-- @param values Table of key - value pairs to initialize the section with (optional)
-- @return Name of created section
add_type(type, values)

--- Deletes a section or an option.
-- @param section UCI section name
-- @param option UCI option (optional)
-- @return Boolean whether operation succeeded
delete(section, option)

--- Deletes all the UCI sections of a given type
-- @param type UCI section type
-- @return Boolean whether operation succeeded
delete_type(type)

--- Set a value or create a named section.
-- @param section UCI section name
-- @param option UCI option or UCI section type
-- @param value UCI value or nil if you want to create a section
-- @return Boolean whether operation succeeded
set(section, option, value)

--- Set given values as list.
-- @param section UCI section name
-- @param option UCI option
-- @param value UCI value
-- @return Boolean whether operation succeeded
set_list(section, option, value)

--- Get a table with the information of some sections of a given type
-- @param type UCI section type
-- @param index UCI section type index (optional)
-- @param option UCI option (optional)
-- @return Table or UCI value
get_type(type, index, option)

--- Get a table with all the sections of a given type
-- @param type UCI section type
-- @return Table
get_all_type(type)

--- Get a table with the information of the section of a given type and index
-- @param type UCI section type
-- @param index UCI section type index
-- @return Table
get_type_index(type, index)

--- Get an option of the section of a given type and index
-- @param type UCI section type
-- @param index UCI section type index
-- @param option UCI option
-- @return UCI value
get_type_option(type, index, option)

--- Commit the changed done with a UCI-Cursor
-- @param c UCI-Cursor
-- @return Boolean whether operation succeeded
commit(c)

--- Create a new UCI-Cursor
-- @return UCI-Cursor or an error on failure
raw()

--- Applies UCI configuration changes
-- @param cmd Don't apply only return the command
apply(cmd)

control

--- Remove the current bgp configuration
remove_bgp_config()

--- Add a bgp peer
-- @param as AS of the BGP peer (if doesn't exist, it should be given as an argument)
-- @param ip IP of the BGP peer (if doesn't exist, it should be given as an argument)
-- @param netmask Netmask of the BGP peer (if doesn't exist, it should be given as an argument)
-- @return Boolean whether operation succeeded
add_bgp_peer(as, ipdest, netmask)

--- Add a network to being published by bgp
-- @param network network range to be published (if doesn't exist, it should be given as an argument)
-- @return Boolean whether operation succeeded
add_bgp_network(range)

--- Set the devices working on bpg mode
-- @param devices Devices working on bgp mode (if doesn't exist, it should be given as an argument)
-- @return Boolean whether operation succeeded
set_bgp_devices(devices)

--- Set the AS of the working node
-- @param as AS of the working node (if doesn't exist, it should be given as an argument)
-- @return Boolean whether operation succeeded
set_bgp_as(as)

--- Applies UCI configuration changes
apply_changes()

more information

http://wiki.openwrt.org/doc/techref/uci
http://luci.subsignal.org/api/luci

Actualitzat per Joel Espunya fa més de 12 anys · 5 revisions