NM.Device¶
- Subclasses:
NM.Device6Lowpan,NM.DeviceAdsl,NM.DeviceBond,NM.DeviceBridge,NM.DeviceBt,NM.DeviceDummy,NM.DeviceEthernet,NM.DeviceGeneric,NM.DeviceHsr,NM.DeviceIPTunnel,NM.DeviceInfiniband,NM.DeviceIpvlan,NM.DeviceLoopback,NM.DeviceMacsec,NM.DeviceMacvlan,NM.DeviceModem,NM.DeviceOlpcMesh,NM.DeviceOvsBridge,NM.DeviceOvsInterface,NM.DeviceOvsPort,NM.DevicePpp,NM.DeviceTeam,NM.DeviceTun,NM.DeviceVlan,NM.DeviceVrf,NM.DeviceVxlan,NM.DeviceWifi,NM.DeviceWifiP2P,NM.DeviceWimax,NM.DeviceWireGuard,NM.DeviceWpan
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r |
|||
r/w |
|||
r |
|||
r |
|||
r |
|||
r |
|||
r |
|||
r |
|||
r |
|||
r |
|||
r |
|||
r |
|||
r |
|||
r |
|||
r |
|||
r |
|||
r |
|||
r |
|||
r |
|||
r |
|||
r |
|||
r |
|||
r |
|||
r |
|||
r |
|||
r |
|||
r |
|||
r |
|||
r |
|||
r |
|||
r |
|||
r |
Signals¶
- Inherited:
Name |
Short Description |
|---|---|
Notifies the state change of a |
Fields¶
- Inherited:
Class Details¶
- class NM.Device(**kwargs)¶
- Bases:
- Abstract:
Yes
- Structure:
- classmethod disambiguate_names(devices)¶
- Parameters:
- Returns:
the device names
- Return type:
[
str]
Generates a list of short-ish unique presentation names for the devices in devices.
- connection_compatible(connection)¶
- Parameters:
connection (
NM.Connection) – anNM.Connectionto validate against self- Raises:
- Returns:
Trueif the connection may be activated with this device,Falseif is incompatible with the device’s capabilities and characteristics.- Return type:
Validates a given connection for a given
NM.Deviceobject and returns whether the connection may be activated with the device. For example if self is a Wi-Fi device that supports only WEP encryption, the connection will only be valid if it is a Wi-Fi connection which describes a WEP or open network, and will not be valid if it describes a WPA network, or if it is an Ethernet, Bluetooth, WWAN, etc connection that is incompatible with the device.This function does the same as
NM.Device.connection_valid(), i.e. checking compatibility of the given device and connection. But, in addition, it setsGLib.ErrorwhenFalseis returned.
- connection_valid(connection)¶
- Parameters:
connection (
NM.Connection) – anNM.Connectionto validate against self- Returns:
Trueif the connection may be activated with this device,Falseif is incompatible with the device’s capabilities and characteristics.- Return type:
Validates a given connection for a given
NM.Deviceobject and returns whether the connection may be activated with the device. For example if self is a Wi-Fi device that supports only WEP encryption, the connection will only be valid if it is a Wi-Fi connection which describes a WEP or open network, and will not be valid if it describes a WPA network, or if it is an Ethernet, Bluetooth, WWAN, etc connection that is incompatible with the device.
- delete(cancellable)¶
- Parameters:
cancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone- Raises:
- Returns:
Trueon success,Falseon error, in which case error will be set.- Return type:
Deletes the software device. Hardware devices can’t be deleted.
Deprecated since version 1.22: Use
NM.Device.delete_async() orGio.DBusConnection.
- delete_async(cancellable, callback, *user_data)¶
- Parameters:
cancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNonecallback (
Gio.AsyncReadyCallbackorNone) – callback to be called when delete operation completesuser_data (
objectorNone) – caller-specific data passed to callback
Asynchronously begins deleting the software device. Hardware devices can’t be deleted.
- delete_finish(result)¶
- Parameters:
result (
Gio.AsyncResult) – the result passed to theGio.AsyncReadyCallback- Raises:
- Returns:
Trueon success,Falseon error, in which case error will be set.- Return type:
Gets the result of a call to
NM.Device.delete_async().
- disconnect(cancellable)¶
- Parameters:
cancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone- Raises:
- Returns:
Trueon success,Falseon error, in which case error will be set.- Return type:
Disconnects the device if currently connected, and prevents the device from automatically connecting to networks until the next manual network connection request.
Deprecated since version 1.22: Use
NM.Device.disconnect_async() orGio.DBusConnection.
- disconnect_async(cancellable, callback, *user_data)¶
- Parameters:
cancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNonecallback (
Gio.AsyncReadyCallbackorNone) – callback to be called when the disconnect operation completesuser_data (
objectorNone) – caller-specific data passed to callback
Asynchronously begins disconnecting the device if currently connected, and prevents the device from automatically connecting to networks until the next manual network connection request.
- disconnect_finish(result)¶
- Parameters:
result (
Gio.AsyncResult) – the result passed to theGio.AsyncReadyCallback- Raises:
- Returns:
Trueon success,Falseon error, in which case error will be set.- Return type:
Gets the result of a call to
NM.Device.disconnect_async().
- filter_connections(connections)¶
- Parameters:
connections ([
NM.Connection]) – an array ofNM.Connectionsto filter- Returns:
an array of
NM.Connectionsthat could be activated with the given self. The array should be freed with g_ptr_array_unref() when it is no longer required.WARNING: the transfer annotation for this function may not work correctly with bindings. See https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/305. You can filter the list yourself with
NM.Device.connection_valid().- Return type:
Filters a given array of connections for a given
NM.Deviceobject and returns connections which may be activated with the device. For example if self is a Wi-Fi device that supports only WEP encryption, the returned array will contain any Wi-Fi connections in connections that allow connection to unencrypted or WEP-enabled SSIDs. The returned array will not contain Ethernet, Bluetooth, Wi-Fi WPA connections, or any other connection that is incompatible with the device. To get the full list of connections seeNM.Client.get_connections().
- get_active_connection()¶
- Returns:
the
NM.ActiveConnectionorNoneif the device is not part of an active connection- Return type:
Gets the
NM.ActiveConnectionobject which owns this device during activation.
- get_applied_connection(flags, cancellable)¶
- Parameters:
flags (
int) – the flags argument. SeeNM.DeviceReapplyFlags.cancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone
- Raises:
- Returns:
a
NM.Connectionwith the currently applied settings orNoneon error.The connection is as received from D-Bus and might not validate according to
NM.Connection.verify().- version_id:
returns the current version id of the applied connection
- Return type:
(
NM.Connection, version_id:int)
Fetch the currently applied connection on the device.
New in version 1.2.
Deprecated since version 1.22: Use
NM.Device.get_applied_connection_async() orGio.DBusConnection.
- get_applied_connection_async(flags, cancellable, callback, *user_data)¶
- Parameters:
flags (
int) – the flags argument. SeeNM.DeviceReapplyFlags.cancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNonecallback (
Gio.AsyncReadyCallbackorNone) – callback to be called when the reapply operation completesuser_data (
objectorNone) – caller-specific data passed to callback
Asynchronously begins and gets the currently applied connection.
New in version 1.2.
- get_applied_connection_finish(result)¶
- Parameters:
result (
Gio.AsyncResult) – the result passed to theGio.AsyncReadyCallback- Raises:
- Returns:
a currently applied
NM.ConnectionorNonein case of error.The connection is as received from D-Bus and might not validate according to
NM.Connection.verify().- version_id:
the current version id of the applied connection.
- Return type:
(
NM.Connection, version_id:int)
Gets the result of a call to
NM.Device.get_applied_connection_async().New in version 1.2.
- get_available_connections()¶
- Returns:
the
GLib.PtrArraycontainingNM.RemoteConnections. This is the internal copy used by the connection, and must not be modified.- Return type:
Gets the
NM.RemoteConnectionscurrently known to the daemon that could be activated on self.
- get_capabilities()¶
- Returns:
the capabilities
- Return type:
Gets the device’ capabilities.
- get_connectivity(addr_family)¶
- Parameters:
addr_family (
int) – network address family- Returns:
the current connectivity state
- Return type:
The connectivity state of the device for given address family. Supported address families are %AF_INET for IPv4, %AF_INET6 for IPv6 or %AF_UNSPEC for any.
New in version 1.16.
- get_description()¶
- Returns:
a description of self. If either the vendor or the product name is unknown, this returns the interface name.
- Return type:
Gets a description of self, based on its vendor and product names.
- get_device_type()¶
- Returns:
the device type
- Return type:
Returns the numeric type of the
NM.Device, ie Ethernet, Wi-Fi, etc.
- get_dhcp4_config()¶
- Returns:
the IPv4
NM.DhcpConfig, orNoneif the device is not activated or not using DHCP.- Return type:
Gets the current IPv4
NM.DhcpConfigassociated with theNM.Device.You can alternatively use
NM.ActiveConnection.get_dhcp4_config(), which also works with VPN connections.
- get_dhcp6_config()¶
- Returns:
the IPv6
NM.DhcpConfig, orNoneif the device is not activated or not using DHCPv6.- Return type:
Gets the current IPv6
NM.DhcpConfigassociated with theNM.Device.You can alternatively use
NM.ActiveConnection.get_dhcp6_config(), which also works with VPN connections.
- get_driver()¶
- Returns:
the driver of the device. This is the internal string used by the device, and must not be modified.
- Return type:
Gets the driver of the
NM.Device.
- get_driver_version()¶
- Returns:
the version of the device driver. This is the internal string used by the device, and must not be modified.
- Return type:
Gets the driver version of the
NM.Device.
- get_firmware_missing()¶
- Returns:
Trueif firmware required for the device’s operation is likely to be missing.- Return type:
Indicates that firmware required for the device’s operation is likely to be missing.
- get_firmware_version()¶
- Returns:
the firmware version of the device. This is the internal string used by the device, and must not be modified.
- Return type:
Gets the firmware version of the
NM.Device.
- get_hw_address()¶
- Returns:
the current MAC of the device, or
None. This is the internal string used by the device, and must not be modified.- Return type:
Gets the current a hardware address (MAC) for the self.
- get_iface()¶
- Returns:
the interface of the device. This is the internal string used by the device, and must not be modified.
- Return type:
Gets the interface name of the
NM.Device.
- get_interface_flags()¶
- Returns:
the flags
- Return type:
Gets the interface flags of the device.
New in version 1.22.
- get_ip4_config()¶
- Returns:
the IPv4
NM.IPConfig, orNoneif the device is not activated.- Return type:
Gets the current IPv4
NM.IPConfigassociated with theNM.Device.You can alternatively use
NM.ActiveConnection.get_ip4_config(), which also works with VPN connections.
- get_ip6_config()¶
- Returns:
the IPv6
NM.IPConfigorNoneif the device is not activated.- Return type:
Gets the current IPv6
NM.IPConfigassociated with theNM.Device.You can alternatively use
NM.ActiveConnection.get_ip6_config(), which also works with VPN connections.
- get_ip_iface()¶
- Returns:
the IP traffic interface of the device. This is the internal string used by the device, and must not be modified.
- Return type:
Gets the IP interface name of the
NM.Deviceover which IP traffic flows when the device is in the ACTIVATED state.
- get_lldp_neighbors()¶
- Returns:
the
GLib.PtrArraycontainingNM.LldpNeighbors. This is the internal copy used by the device and must not be modified. The library never modifies the returned array and thus it is safe for callers to reference and keep using it.- Return type:
Gets the list of neighbors discovered through LLDP.
New in version 1.2.
- get_metered()¶
- Returns:
the metered setting.
- Return type:
Gets the metered setting of a
NM.Device.New in version 1.2.
- get_nm_plugin_missing()¶
-
Indicates that the NetworkManager plugin for the device is not installed.
New in version 1.2.
- get_path()¶
- Returns:
the path of the device.
The string is backslash escaped (C escaping) for invalid characters. The escaping can be reverted with
GLib.strcompress(), however the result may not be valid UTF-8.- Return type:
Gets the path of the
NM.Deviceas exposed by the udev property ID_PATH.New in version 1.26.
- get_physical_port_id()¶
- Returns:
the physical port ID of the device, or
Noneif the port ID is unknown. This is the internal string used by the device and must not be modified.- Return type:
Gets the physical port ID of the
NM.Device. If non-None, this is an opaque string that can be used to recognize when seemingly-unrelatedNM.Devicesare actually just different virtual ports on a single physical port. (Eg, NPAR / SR-IOV.)
- get_ports()¶
- Returns:
the
GLib.PtrArraycontainingNM.Devicesthat are ports of self. This is the internal copy used by the device and must not be modified.- Return type:
Gets the devices currently set as port of self.
New in version 1.34.
- get_product()¶
- Returns:
the product name of the device. This is the internal string used by the device, and must not be modified.
The string is backslash escaped (C escaping) for invalid characters. The escaping can be reverted with
GLib.strcompress(), however the result may not be valid UTF-8.- Return type:
Gets the product string of the
NM.Device.
- get_setting_type()¶
- Returns:
self's associated
NM.Settingtype- Return type:
Gets the (primary)
NM.Settingsubtype associated with connections that can be used on self.
- get_state_reason()¶
- Returns:
the reason for entering the current device state
- Return type:
Gets the reason for entering the current
NM.Devicestate.
- get_type_description()¶
- Returns:
the type description of the device. This is the internal string used by the device, and must not be modified.
- Return type:
Gets a (non-localized) description of the type of device that self is.
- get_udi()¶
- Returns:
the Unique Device Identifier of the device. This identifier may be used to gather more information about the device from various operating system services like udev or sysfs.
- Return type:
Gets the Unique Device Identifier of the
NM.Device.
- get_vendor()¶
- Returns:
the vendor name of the device. This is the internal string used by the device, and must not be modified.
The string is backslash escaped (C escaping) for invalid characters. The escaping can be reverted with
GLib.strcompress(), however the result may not be valid UTF-8.- Return type:
Gets the vendor string of the
NM.Device.
- is_real()¶
- Returns:
Trueif the device exists, orFalseif it is a placeholder device that could be automatically created by NetworkManager if one of itsNM.Device:available-connectionswas activated.- Return type:
New in version 1.2.
- is_software()¶
-
Whether the device is a software device.
- reapply(connection, version_id, flags, cancellable)¶
- Parameters:
connection (
NM.ConnectionorNone) – theNM.Connectionto replace the applied settings with orNoneto reuse existingversion_id (
int) – zero or the expected version id of the applied connection. If specified and the version id mismatches, the call fails without modification. This allows to catch concurrent accesses.flags (
int) – always set this to zerocancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone
- Raises:
- Returns:
Trueon success,Falseon error, in which case error will be set.- Return type:
Attempts to update device with changes to the currently active connection made since it was last applied.
New in version 1.2.
Deprecated since version 1.22: Use
NM.Device.reapply_async() orGio.DBusConnection.
- reapply_async(connection, version_id, flags, cancellable, callback, *user_data)¶
- Parameters:
connection (
NM.ConnectionorNone) – theNM.Connectionto replace the applied settings with orNoneto reuse existingversion_id (
int) – zero or the expected version id of the applied connection. If specified and the version id mismatches, the call fails without modification. This allows to catch concurrent accesses.flags (
int) – always set this to zerocancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNonecallback (
Gio.AsyncReadyCallbackorNone) – callback to be called when the reapply operation completesuser_data (
objectorNone) – caller-specific data passed to callback
Asynchronously begins an attempt to update device with changes to the currently active connection made since it was last applied.
New in version 1.2.
- reapply_finish(result)¶
- Parameters:
result (
Gio.AsyncResult) – the result passed to theGio.AsyncReadyCallback- Raises:
- Returns:
Trueon success,Falseon error, in which case error will be set.- Return type:
Gets the result of a call to
NM.Device.reapply_async().New in version 1.2.
- set_autoconnect(autoconnect)¶
-
Enables or disables automatic activation of the
NM.Device.Deprecated since version 1.22: Use the async command
NM.Client.dbus_set_property() onNM.Object.get_path(), %NM_DBUS_INTERFACE_DEVICE to set “Autoconnect” property to a “(b)” value. This function is deprecated because it calls a synchronous D-Bus method and modifies the content of theNM.Clientcache client side.
- set_managed(managed)¶
-
Enables or disables management of
NM.Deviceby NetworkManager.New in version 1.2.
Deprecated since version 1.22: Use the async command
NM.Client.dbus_set_property() onNM.Object.get_path(), interface %NM_DBUS_INTERFACE_DEVICE to set the “Managed” property to a “(b)” boolean value. This function is deprecated because it calls a synchronous D-Bus method and modifies the content of theNM.Clientcache client side. Also, it does not emit a property changed signal.
Signal Details¶
Property Details¶
- NM.Device.props.active_connection¶
- Name:
active-connection- Type:
- Default Value:
- Flags:
The
NM.ActiveConnectionobject that “owns” this device during activation.
- NM.Device.props.autoconnect¶
-
Whether the device can auto-activate a connection.
The property setter is a synchronous D-Bus call. This is deprecated since 1.22.
- NM.Device.props.available_connections¶
- Name:
available-connections- Type:
- Default Value:
- Flags:
The available connections of the device
- NM.Device.props.capabilities¶
- Name:
capabilities- Type:
- Default Value:
- Flags:
The capabilities of the device.
- NM.Device.props.device_type¶
- Name:
device-type- Type:
- Default Value:
- Flags:
The numeric type of the device.
- NM.Device.props.dhcp4_config¶
- Name:
dhcp4-config- Type:
- Default Value:
- Flags:
The IPv4
NM.DhcpConfigof the device.
- NM.Device.props.dhcp6_config¶
- Name:
dhcp6-config- Type:
- Default Value:
- Flags:
The IPv6
NM.DhcpConfigof the device.
- NM.Device.props.driver¶
-
The driver of the device.
- NM.Device.props.driver_version¶
-
The version of the device driver.
- NM.Device.props.firmware_missing¶
-
When
Trueindicates the device is likely missing firmware required for its operation.
- NM.Device.props.firmware_version¶
-
The firmware version of the device.
- NM.Device.props.hw_address¶
-
The hardware address of the device.
New in version 1.24.
- NM.Device.props.interface¶
-
The interface of the device.
- NM.Device.props.interface_flags¶
-
The interface flags.
New in version 1.22.
- NM.Device.props.ip4_config¶
- Name:
ip4-config- Type:
- Default Value:
- Flags:
The #NMIP4Config of the device.
- NM.Device.props.ip4_connectivity¶
- Name:
ip4-connectivity- Type:
- Default Value:
- Flags:
The IPv4 connectivity state of the device.
New in version 1.16.
- NM.Device.props.ip6_config¶
- Name:
ip6-config- Type:
- Default Value:
- Flags:
The IPv6
NM.IPConfigof the device.
- NM.Device.props.ip6_connectivity¶
- Name:
ip6-connectivity- Type:
- Default Value:
- Flags:
The IPv6 connectivity state of the device.
New in version 1.16.
- NM.Device.props.ip_interface¶
-
The IP interface of the device which should be used for all IP-related operations like addressing and routing.
- NM.Device.props.lldp_neighbors¶
- Name:
lldp-neighbors- Type:
- Default Value:
- Flags:
The LLDP neighbors.
- NM.Device.props.managed¶
-
Whether the device is managed by NetworkManager.
- NM.Device.props.metered¶
-
Whether the device is metered.
New in version 1.2.
- NM.Device.props.nm_plugin_missing¶
-
When
Trueindicates that the NetworkManager plugin for the device is not installed.New in version 1.2.
- NM.Device.props.physical_port_id¶
-
The physical port ID of the device. (See
NM.Device.get_physical_port_id().)
- NM.Device.props.ports¶
- Name:
ports- Type:
- Default Value:
- Flags:
The port devices of the controller device. For devices that cannot be controllers this is likely to be always empty.
New in version 1.34.
- NM.Device.props.product¶
-
The product string of the device.
- NM.Device.props.real¶
-
Whether the device is real or is a placeholder device that could be created automatically by NetworkManager if one of its
NM.Device:available-connectionswas activated.New in version 1.2.
- NM.Device.props.state¶
- Name:
state- Type:
- Default Value:
- Flags:
The state of the device.
- NM.Device.props.state_reason¶
-
The reason for the device state.
- NM.Device.props.udi¶
-
An operating-system specific device hardware identifier; this is not unique to a specific hardware device across reboots or hotplugs. It is an opaque string which for some device types (Bluetooth, Modem) contains an identifier provided by the underlying hardware service daemon such as Bluez or ModemManager, and clients can use this property to request more information about the device from those services.