Class: Device

LuCI.Network.Device

A Network.Device class instance represents an underlying Linux network device and allows querying device details such as packet statistics or MTU.

Methods

getBridgeID() → {null|string}

Get the bridge ID

Source:
Returns:

Returns the ID of this network bridge or null if this network device is not a Linux bridge.

Type
null | string

getBridgeSTP() → {boolean}

Get the bridge STP setting

Source:
Returns:

Returns true when this device is a Linux bridge and has stp enabled, else false.

Type
boolean

getI18n() → {string}

Get a long description string for the device.

Source:
Returns:

Returns a string containing the type description and device name for non-wifi devices or operation mode and ssid for wifi ones.

Type
string

getIP6Addrs() → {Array.<string>}

Get the IPv6 addresses configured on the device.

Source:
Returns:

Returns an array of IPv6 address strings.

Type
Array.<string>

getIPAddrs() → {Array.<string>}

Get the IPv4 addresses configured on the device.

Source:
Returns:

Returns an array of IPv4 address strings.

Type
Array.<string>

getMAC() → {null|string}

Get the MAC address of the device.

Source:
Returns:

Returns the MAC address of the device or null if not applicable, e.g. for non-ethernet tunnel devices.

Type
null | string

getMTU() → {number}

Get the MTU of the device.

Source:
Returns:

Returns the MTU of the device.

Type
number

getName() → {string}

Get the name of the network device.

Source:
Returns:

Returns the name of the device, e.g. eth0 or wlan0.

Type
string

getNetwork() → {null|LuCI.Network.Protocol}

Get the primary logical interface this device is assigned to.

Source:
Returns:

Returns a Network.Protocol instance representing the logical interface this device is attached to or null if it is not assigned to any logical interface.

Type
null | LuCI.Network.Protocol

getNetworks() → {Array.<LuCI.Network.Protocol>}

Get the logical interfaces this device is assigned to.

Source:
Returns:

Returns an array of Network.Protocol instances representing the logical interfaces this device is assigned to.

Type
Array.<LuCI.Network.Protocol>

getPorts() → {null|Array.<LuCI.Network.Device>}

Get the associated bridge ports of the device.

Source:
Returns:

Returns an array of Network.Device instances representing the ports (slave interfaces) of the bridge or null when this device isn't a Linux bridge.

Type
null | Array.<LuCI.Network.Device>

getRXBytes() → {number}

Get the amount of received bytes.

Source:
Returns:

Returns the amount of bytes received by the network device.

Type
number

getRXPackets() → {number}

Get the amount of received packets.

Source:
Returns:

Returns the amount of packets received by the network device.

Type
number

getShortName() → {string}

Get a short description string for the device.

Source:
Returns:

Returns the device name for non-wifi devices or a string containing the operation mode and SSID for wifi devices.

Type
string

getTXBytes() → {number}

Get the amount of transmitted bytes.

Source:
Returns:

Returns the amount of bytes transmitted by the network device.

Type
number

getTXPackets() → {number}

Get the amount of transmitted packets.

Source:
Returns:

Returns the amount of packets transmitted by the network device.

Type
number

getType() → {string}

Get the type of the device..

Source:
Returns:

Returns a string describing the type of the network device:

  • alias if it is an abstract alias device (@ notation)
  • wifi if it is a wireless interface (e.g. wlan0)
  • bridge if it is a bridge device (e.g. br-lan)
  • tunnel if it is a tun or tap device (e.g. tun0)
  • vlan if it is a vlan device (e.g. eth0.1)
  • switch if it is a switch device (e.g.eth1 connected to switch0)
  • ethernet for all other device types
Type
string

getTypeI18n() → {string}

Get a string describing the device type.

Source:
Returns:

Returns a string describing the type, e.g. "Wireless Adapter" or "Bridge".

Type
string

getWifiNetwork() → {null|LuCI.Network.WifiNetwork}

Get the related wireless network this device is related to.

Source:
Returns:

Returns a Network.WifiNetwork instance representing the wireless network corresponding to this network device or null if this device is not a wireless device.

Type
null | LuCI.Network.WifiNetwork

isBridge() → {boolean}

Checks whether this device is a Linux bridge.

Source:
Returns:

Returns true when the network device is present and a Linux bridge, else false.

Type
boolean

isBridgePort() → {boolean}

Checks whether this device is part of a Linux bridge.

Source:
Returns:

Returns true when this network device is part of a bridge, else false.

Type
boolean

isUp() → {boolean}

Checks whether this device is up.

Source:
Returns:

Returns true when the associated device is running pr false when it is down or absent.

Type
boolean