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.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.Connection
to validate against self- Raises:
- Returns:
True
if the connection may be activated with this device,False
if is incompatible with the device’s capabilities and characteristics.- Return type:
Validates a given connection for a given
NM.Device
object 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.Error
whenFalse
is returned.
- connection_valid(connection)¶
- Parameters:
connection (
NM.Connection
) – anNM.Connection
to validate against self- Returns:
True
if the connection may be activated with this device,False
if is incompatible with the device’s capabilities and characteristics.- Return type:
Validates a given connection for a given
NM.Device
object 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.Cancellable
orNone
) – aGio.Cancellable
, orNone
- Raises:
- Returns:
True
on success,False
on 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.Cancellable
orNone
) – aGio.Cancellable
, orNone
callback (
Gio.AsyncReadyCallback
orNone
) – callback to be called when delete operation completesuser_data (
object
orNone
) – 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:
True
on success,False
on 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.Cancellable
orNone
) – aGio.Cancellable
, orNone
- Raises:
- Returns:
True
on success,False
on 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.Cancellable
orNone
) – aGio.Cancellable
, orNone
callback (
Gio.AsyncReadyCallback
orNone
) – callback to be called when the disconnect operation completesuser_data (
object
orNone
) – 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:
True
on success,False
on 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.Connections
to filter- Returns:
an array of
NM.Connections
that 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.Device
object 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.ActiveConnection
orNone
if the device is not part of an active connection- Return type:
Gets the
NM.ActiveConnection
object which owns this device during activation.
- get_applied_connection(flags, cancellable)¶
- Parameters:
flags (
int
) – the flags argument. SeeNM.DeviceReapplyFlags
.cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
, orNone
- Raises:
- Returns:
a
NM.Connection
with the currently applied settings orNone
on 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.Cancellable
orNone
) – aGio.Cancellable
, orNone
callback (
Gio.AsyncReadyCallback
orNone
) – callback to be called when the reapply operation completesuser_data (
object
orNone
) – 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.Connection
orNone
in 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.PtrArray
containingNM.RemoteConnections
. This is the internal copy used by the connection, and must not be modified.- Return type:
Gets the
NM.RemoteConnections
currently 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
, orNone
if the device is not activated or not using DHCP.- Return type:
Gets the current IPv4
NM.DhcpConfig
associated 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
, orNone
if the device is not activated or not using DHCPv6.- Return type:
Gets the current IPv6
NM.DhcpConfig
associated 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:
True
if 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
, orNone
if the device is not activated.- Return type:
Gets the current IPv4
NM.IPConfig
associated 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.IPConfig
orNone
if the device is not activated.- Return type:
Gets the current IPv6
NM.IPConfig
associated 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.Device
over which IP traffic flows when the device is in the ACTIVATED state.
- get_lldp_neighbors()¶
- Returns:
the
GLib.PtrArray
containingNM.LldpNeighbor
s. 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.Device
as 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
None
if 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.Devices
are actually just different virtual ports on a single physical port. (Eg, NPAR / SR-IOV.)
- get_ports()¶
- Returns:
the
GLib.PtrArray
containingNM.Devices
that are slaves 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.Setting
type- Return type:
Gets the (primary)
NM.Setting
subtype 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.Device
state.
- 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:
True
if the device exists, orFalse
if it is a placeholder device that could be automatically created by NetworkManager if one of itsNM.Device
:available-connections
was 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.Connection
orNone
) – theNM.Connection
to replace the applied settings with orNone
to 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.Cancellable
orNone
) – aGio.Cancellable
, orNone
- Raises:
- Returns:
True
on success,False
on 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.Connection
orNone
) – theNM.Connection
to replace the applied settings with orNone
to 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.Cancellable
orNone
) – aGio.Cancellable
, orNone
callback (
Gio.AsyncReadyCallback
orNone
) – callback to be called when the reapply operation completesuser_data (
object
orNone
) – 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:
True
on success,False
on 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.Client
cache client side.
- set_managed(managed)¶
-
Enables or disables management of
NM.Device
by 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.Client
cache 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.ActiveConnection
object 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.DhcpConfig
of the device.
- NM.Device.props.dhcp6_config¶
- Name:
dhcp6-config
- Type:
- Default Value:
- Flags:
The IPv6
NM.DhcpConfig
of 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
True
indicates 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.IPConfig
of 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
True
indicates 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-connections
was 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.