qMp reference (GSoC)¶
model [Use qmp.debug]¶
--- 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)
bgp [Use qmp.model]¶
--- Get the published networks of the current node
-- @return table
get_networks()
--- Get the devices working on bpg mode
-- @return UCI value
get_devices()
--- Add a BGP peer
-- @param as AS of the BGP peer
-- @param ip IP of the BGP peer
-- @param netmask Netmask of the BGP peer
-- @return Name of created section
add_peer(as, ip, netmask)
--- Set the devices working on BGP mode
-- @param devices Devices working on bgp mode (string)
-- @return Boolean whether operation succeeded
set_device(devices)
--- Add a network to being published by BGP
-- @param network network range to be published
-- @return Boolean whether operation succeeded
add_network(network)
--- Remove the current BGP configuration
clear()
--- Set the AS of the working node
-- @param as AS of the working node
-- @return Boolean whether operation succeeded
set_as(as)
--- Get the AS of the working node
-- @return AS of the working node
get_as()
network [Use qmp.model]¶
*add_if(name,iface) ##proto=none
*add_br(name,ifaces) ##proto=none
*add_alias(name,viface) ##proto=none
*set_ipv4(name,ip,mask) ##proto=static
*set_ipv6(name,network ##proto=static
*set_dhcp(name) ##proto=dhcp
*set_dns(dns) ##defined in loopback
*add_route4(name,viface,ipdest,netmask,gw) ##(guifi,backbone1,10.0.0.0,255.0.0.0,172.77.11.1)
*add_route6(...)
*add_iptun(...)
control [Use qmp.model and qmpl.bgp]¶
--- 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()
debug¶
--- Add one line to the system log file with the tag qMp
-- @param msg string
logger(msg)
more information¶
http://wiki.openwrt.org/doc/techref/uci
http://luci.subsignal.org/api/luci
Actualitzat per Pau Escrich fa més de 12 anys · 11 revisions