network — Plugin for managing a host’s network configuration

class Network

A plugin for OpenWRT’s network configuration

DDNS()
Render the dynamic DNS configuration page
DHCPServer()
Render the DHCP Server (dnsmasq) configuration page
Firewall()
Render the wireless configuration page
Interfaces()
Render the network configuration page
QOS()
Render the Quality of Service (QOS: traffic shaping) configuration page
StaticRoutes()
Render the static route configuration page
Switch()
Render the switch configuration page
Wireless()
Render the wireless configuration page
add_ddns(config=None, **kwargs)
Creates a new Dynamic DNS configuration in /etc/config/ddns. Requires ‘config’.
add_dhcp_interface(interface=None, **kwargs)
Creates new dhcp interface configuration elements in /etc/config/dhcp
add_firewall_rule(**kwargs)
Creates new firewall rule in /etc/config/firewall
add_firewall_zone(**kwargs)
Creates new firewall zone in /etc/config/firewall
add_interface(config=None, alias_config=None, **kwargs)
Creates a new interface or alias configuration section to /etc/config/network depending on whether or not config or alias_config was passed.
add_qos_config(config=None, **kwargs)
Creates new qos configuration in /etc/config/qos
add_redirect(**kwargs)
Creates new firewall redirect (port forwarding) rule in /etc/config/firewall
add_route(config=None, **kwargs)
Adds a new IPv4 or IPv6 route configuration section to /etc/config/network depending on whether or not config=route or config=route6.
add_switch(config=None, **kwargs)
Adds a new switch configuration section to /etc/config/network. ‘config’ is expected to be the interface these settings apply to.
add_wireless_device(config=None, **kwargs)
Creates new wireless device configuration in /etc/config/wireless
add_wireless_interface(config=None, **kwargs)
Creates new wireless device configuration in /etc/config/wireless
ddns_config()
Render the Dynamic DNS configuration tab
ddns_options_meta(option=None, section=None, help=True, values=False, **data)
By default, return help text for the provided Dynamic DNS option (for jTip). If ‘values’ is True, return a json-formatted list of possible values for the given option/section. If ‘section’ is provided, attempt to obtain valid values from the specified section of the validation file.
ddns_raw()
Render the raw /etc/config/ddns file edit page.
dhcp_config()
Render the dhcp configuration tab
dhcp_interface_options_meta(option=None, section=None, help=True, values=False, **data)
By default, return help text for the provided dhcp interface option (for jTip). If ‘values’ is True, return a json-formatted list of possible values for the given option/section. If ‘section’ is provided, attempt to obtain valid values from the specified section of the validation file.
dhcp_leases_json(rows=None, sidx=None, _search=None, searchField=None, searchOper=None, searchString=None, page=None, sord=None, nd=None)
Render the dnsmasq DHCP lease table in jqGrid json format
dhcp_raw()
Render the raw dhcp configuration file edit page.
dhcp_service_control(operation)
Based on the ‘operation’ parameter, stop, start, or restart the dhcp server.
dhcp_status()
Render the dhcp status tab (whether or not it is running, current leases, etc)
dnsmasq_options_help(option=None, dump=False, **data)
Return help text for the provided option (for jTip)
ethers()
Render the raw /etc/ethers configuration file edit page.
ethers_json(rows=None, sidx=None, _search=None, searchField=None, searchOper=None, searchString=None, page=None, sord=None, nd=None)
Render the /etc/ethers file in jqGrid json format
firewall_defaults_config()
Render the firewall defaults configuration page
firewall_etc()
Render the raw /etc/config/firewall edit page.
firewall_options_meta(option=None, section=None, help=True, values=False, **data)
By default, return help text for the provided firewall option (for jTip). If ‘values’ is True, return a json-formatted list of possible values for the given option/section. If ‘section’ is provided, attempt to obtain valid values from the specified section of the validation file.
firewall_user_tab()
Render the raw firewall.user edit page.
forwarding_config()
Render the firewall forwarding configuration page
get_ethers_spreadsheet(table=None, chain=None)
Exports /etc/ethers as a spreadsheet
index()
Return the index page
interface_options_meta(option=None, section=None, help=True, values=False, **data)
By default, return help text for the provided interface option (for jTip). If ‘values’ is True, return a json-formatted list of possible values for the given option/section. If ‘section’ is provided, attempt to obtain valid values from the specified section of the validation file.
interface_status_tip(interface, **data)
Return a nice little jTip popup showing the status of the given interface
interfaces_tab()
Render the interfaces tab
ipv4_routes()
Render the IPv4 static routes configuration page
ipv6_routes()
Render the IPv6 static routes configuration page
network_raw_tab()
Render the raw network edit tab
new_dhcp_interface()
Render the new dhcp interface tab
new_interface_tab()
Render the new interface tab
new_wireless_device()
Render the new wireless device form
port_forwarding_config()
Render the firewall port forwarding configuration page
qos_classes()
Render the QOS classes configuration page.
qos_classgroups()
Render the QOS classgroups configuration page.
qos_classifications()
Render the QOS classifications configuration page.
qos_defaults()
Render the QOS packet classification defaults configuration page.
qos_interfaces()
Render the QOS interfaces configuration page.
qos_options_meta(option=None, section=None, help=True, values=False, **data)
By default, return help text for the provided QOS option (for jTip). If ‘values’ is True, return a json-formatted list of possible values for the given option/section. If ‘section’ is provided, attempt to obtain valid values from the specified section of the validation file.
qos_raw()
Render the raw qos configuration file edit page.
qos_reclassifications()
Render the QOS reclassifications configuration page.
route6_options_meta(option=None, section=None, help=True, values=False, **data)
By default, return help text for the provided route6 option (for jTip). If ‘values’ is True, return a json-formatted list of possible values for the given option/section. If ‘section’ is provided, attempt to obtain valid values from the specified section of the validation file.
route_options_meta(option=None, section=None, help=True, values=False, **data)
By default, return help text for the provided route option (for jTip). If ‘values’ is True, return a json-formatted list of possible values for the given option/section. If ‘section’ is provided, attempt to obtain valid values from the specified section of the validation file.
routes_tab()
Render the routes tab
rules_config()
Render the firewall rules configuration page
switch_conf()
Render the (guided) switch configuration tab
switch_options_meta(option=None, section=None, help=True, values=False, **data)
Return help text for the provided switch option (for jTip).
update_ddns(config=None, **kwargs)
Updates /etc/config/ddns with the supplied options. Requires ‘config’ which should be represent the original config line (e.g. ‘config “mydns”’). It is used to find the original entry in the event that the user is changing it. Note: The hostname appears to be the only unique identifier for each of these ddns entries.
update_dhcp(config=None, **kwargs)
Updates /etc/config/dhcp with the supplied options. Requires ‘config’ (i.e. ‘dhcp lan’ or ‘dnsmasq’)
update_dhcp_lease(oper=None, id=None, permission=None, user=None, plugin=None)
Performs the specified operation (oper) on the specified dhcp lease(s). Currently only supports deleting but I don’t see any reason why I can’t revisit this in the future to add more fancy stuff.
update_ethers(oper=None, ip=None, id=None, mac=None)
Updates /etc/ethers with the given parameters.
update_firewall_defaults(**kwargs)
Updates /etc/config/firewall with the supplied defaults options.
update_forwarding(forwarding=None, **kwargs)
Updates /etc/config/firewall with the supplied forwarding options. Requires ‘forwarding’
update_interfaces(config=None, **kwargs)
Updates interfaces in /etc/config/network with the supplied options. Requires ‘config’ (i.e. ‘interface lan’)
update_port_forwarding(redirect=None, **kwargs)
Updates /etc/config/firewall with the supplied firewall port forwarding options. Requires ‘redirect’
update_qos(config=None, **kwargs)
Updates /etc/config/qos with the supplied options. Requires ‘config’
update_raw_ddns(ddns)
Save the raw ddns config file text as submitted
update_raw_dhcp(dhcp)
Save the raw dhcp config file text as submitted
update_raw_ethers(ethers)
Save the raw /etc/ethers file as submitted
update_raw_firewall(firewall)
Save the raw firewall config file text as submitted
update_raw_firewall_user(firewall_user)
Save the raw passwd file text as submitted
update_raw_network(network)
Save the raw network config file text as submitted
update_raw_qos(qos)
Save the raw qos config file text as submitted
update_raw_wireless(wireless)
Save the raw wireless config file text as submitted
update_route(config=None, **kwargs)
Updates a route in /etc/config/network with the supplied options. Requires that ‘config’ be formatted like so: ‘<interface>_<target>’
update_rule(rule=None, **kwargs)
Updates /etc/config/firewall with the supplied firewall rule options. Requires ‘rule’
update_switch(config=None, **kwargs)
Updates a switch configuration in /etc/config/network with the supplied options. ‘config’ is expected to be the interface which these settings will be applied to.
update_wireless(config=None, **kwargs)

Updates /etc/config/wireless with the supplied options. Requires ‘config’ which should be one of the following depending on if this is a wifi-device or wifi-iface:

‘wifi-device wlan0’ ‘wifi-iface’

The method figures out the rest from the submitted kwargs.

update_zone(zone=None, **kwargs)
Updates /etc/config/firewall with the supplied zone options. Requires ‘zone’ (i.e. ‘lan’ or ‘wan’)
validate_option(config=None, section=None, **kwargs)
Returns a json-encoded error message if the given option:value pair does not validate
wireless_channel_check(device)
Special method that determines which channels are valid for a given wireless ‘device’. Returns a list of valid channels for the given device in json format. device - A string representing the wireless card name (e.g. ‘wlan0’).
wireless_conf_tab()
Render the wireless devices/interfaces configuration form
wireless_options_meta(option=None, section=None, help=True, values=False, **data)
By default, return help text for the provided wireless option (for jTip). If ‘values’ is True, return a json-formatted list of possible values for the given option/section. If ‘section’ is provided, attempt to obtain valid values from the specified section of the validation file. Note: This method has many special exceptions for various wirless settings.
wireless_raw()
Render the raw /etc/conf/wireless edit form
zone_config()
Render the firewall zone configuration page
delete_dhcp_lease(lease_id)
Deletes the given lease ID from dnsmasq’s DHCP lease list.