NM.Connection¶
- Implementations:
Methods¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
|
|
|
Properties¶
None
Signals¶
Name |
Short Description |
|---|---|
The |
|
The |
|
The |
Fields¶
None
Class Details¶
- class NM.Connection¶
- Bases:
- Structure:
NM.Connectionis the interface implemented byNM.RemoteConnectionon the client side, and #NMSettingsConnection on the daemon side.- add_setting(setting)¶
- Parameters:
setting (
NM.Setting) – theNM.Settingto add to the connection object
Adds a
NM.Settingto the connection, replacing any previousNM.Settingof the same name which has previously been added to theNM.Connection. The connection takes ownership of theNM.Settingobject and does not increase the setting object’s reference count.
- clear_secrets()¶
Clears and frees any secrets that may be stored in the connection, to avoid keeping secret data in memory when not needed.
- clear_secrets_with_flags(func, *user_data)¶
- Parameters:
func (
NM.SettingClearSecretsWithFlagsFnorNone) – function to be called to determine whether a specific secret should be cleared or not. IfNone, all secrets are cleared.user_data (
objectorNone) – caller-supplied data passed to func
Clears and frees secrets determined by func.
- clear_settings()¶
Deletes all of self's settings.
- compare(b, flags)¶
- Parameters:
b (
NM.Connection) – a secondNM.Connectionto compare with the firstflags (
NM.SettingCompareFlags) – compare flags, e.g.NM.SettingCompareFlags.EXACT
- Returns:
- Return type:
Compares two
NM.Connectionobjects for similarity, with comparison behavior modified by a set of flags. SeeNM.Setting.compare() for a description of each flag’s behavior.
- dump()¶
Print the connection (including secrets!) to stdout. For debugging purposes ONLY, should NOT be used for serialization of the setting, or machine-parsed in any way. The output format is not guaranteed to be stable and may change at any time.
- for_each_setting_value(func, *user_data)¶
- Parameters:
func (
NM.SettingValueIterFn) – user-supplied function called for each setting’s propertyuser_data (
objectorNone) – user data passed to func at each invocation
Iterates over the properties of each
NM.Settingobject in theNM.Connection, calling the supplied user function for each property.
- get_connection_type()¶
- Returns:
the type from the connection’s ‘connection’ setting
- Return type:
A shortcut to return the type from the connection’s
NM.SettingConnection.
- get_id()¶
- Returns:
the ID from the connection’s ‘connection’ setting
- Return type:
A shortcut to return the ID from the connection’s
NM.SettingConnection.
- get_interface_name()¶
-
Returns the interface name as stored in NMSettingConnection:interface_name. If the connection contains no
NM.SettingConnection, it will returnNone.For hardware devices and software devices created outside of NetworkManager, this name is used to match the device. for software devices created by NetworkManager, this is the name of the created interface.
- get_path()¶
- Returns:
the D-Bus path of the connection, previously set by a call to
NM.Connection.set_path().- Return type:
Returns the connection’s D-Bus path.
- get_setting(setting_type)¶
- Parameters:
setting_type (
GObject.GType) – theGObject.GTypeof the setting object to return- Returns:
the
NM.Setting, orNoneif no setting of that type was previously added to theNM.Connection- Return type:
Gets the
NM.Settingwith the givenGObject.GType, if one has been previously added to theNM.Connection.
- get_setting_802_1x()¶
- Returns:
an
NM.Setting8021xif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.Setting8021xthe connection might contain.
- get_setting_adsl()¶
- Returns:
an
NM.SettingAdslif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingAdslthe connection might contain.
- get_setting_bluetooth()¶
- Returns:
an
NM.SettingBluetoothif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingBluetooththe connection might contain.
- get_setting_bond()¶
- Returns:
an
NM.SettingBondif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingBondthe connection might contain.
- get_setting_bridge()¶
- Returns:
an
NM.SettingBridgeif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingBridgethe connection might contain.
- get_setting_bridge_port()¶
- Returns:
an
NM.SettingBridgePortif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingBridgePortthe connection might contain.
- get_setting_by_name(name)¶
- Parameters:
name (
str) – a setting name- Returns:
the
NM.Setting, orNoneif no setting with that name was previously added to theNM.Connection- Return type:
Gets the
NM.Settingwith the given name, if one has been previously added theNM.Connection.
- get_setting_cdma()¶
- Returns:
an
NM.SettingCdmaif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingCdmathe connection might contain.
- get_setting_connection()¶
- Returns:
an
NM.SettingConnectionif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingConnectionthe connection might contain.
- get_setting_dcb()¶
- Returns:
an
NM.SettingDcbif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingDcbthe connection might contain.
- get_setting_dummy()¶
- Returns:
an
NM.SettingDummyif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingDummythe connection might contain.New in version 1.8.
- get_setting_generic()¶
- Returns:
an
NM.SettingGenericif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingGenericthe connection might contain.
- get_setting_gsm()¶
- Returns:
an
NM.SettingGsmif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingGsmthe connection might contain.
- get_setting_infiniband()¶
- Returns:
an
NM.SettingInfinibandif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingInfinibandthe connection might contain.
- get_setting_ip4_config()¶
- Returns:
an
NM.SettingIP4Configif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingIP4Configthe connection might contain.Note that it returns the value as type
NM.SettingIPConfig, since the vast majority of IPv4-setting-related methods are on that type, notNM.SettingIP4Config.
- get_setting_ip6_config()¶
- Returns:
an
NM.SettingIP6Configif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingIP6Configthe connection might contain.Note that it returns the value as type
NM.SettingIPConfig, since the vast majority of IPv6-setting-related methods are on that type, notNM.SettingIP6Config.
- get_setting_ip_tunnel()¶
- Returns:
an
NM.SettingIPTunnelif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingIPTunnelthe connection might contain.New in version 1.2.
- get_setting_macsec()¶
- Returns:
an
NM.SettingMacsecif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingMacsecthe connection might contain.New in version 1.6.
- get_setting_macvlan()¶
- Returns:
an
NM.SettingMacvlanif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingMacvlanthe connection might contain.New in version 1.2.
- get_setting_olpc_mesh()¶
- Returns:
an
NM.SettingOlpcMeshif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingOlpcMeshthe connection might contain.
- get_setting_ovs_bridge()¶
- Returns:
an
NM.SettingOvsBridgeif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingOvsBridgethe connection might contain.New in version 1.14.
- get_setting_ovs_interface()¶
- Returns:
an
NM.SettingOvsInterfaceif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingOvsInterfacethe connection might contain.New in version 1.14.
- get_setting_ovs_patch()¶
- Returns:
an
NM.SettingOvsPatchif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingOvsPatchthe connection might contain.New in version 1.14.
- get_setting_ovs_port()¶
- Returns:
an
NM.SettingOvsPortif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingOvsPortthe connection might contain.New in version 1.14.
- get_setting_ppp()¶
- Returns:
an
NM.SettingPppif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingPppthe connection might contain.
- get_setting_pppoe()¶
- Returns:
an
NM.SettingPppoeif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingPppoethe connection might contain.
- get_setting_proxy()¶
- Returns:
an
NM.SettingProxyif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingProxythe connection might contain.New in version 1.6.
- get_setting_serial()¶
- Returns:
an
NM.SettingSerialif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingSerialthe connection might contain.
- get_setting_tc_config()¶
- Returns:
an
NM.SettingTCConfigif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingTCConfigthe connection might contain.New in version 1.12.
- get_setting_team()¶
- Returns:
an
NM.SettingTeamif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingTeamthe connection might contain.
- get_setting_team_port()¶
- Returns:
an
NM.SettingTeamPortif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingTeamPortthe connection might contain.
- get_setting_tun()¶
- Returns:
an
NM.SettingTunif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingTunthe connection might contain.New in version 1.14.
- get_setting_vlan()¶
- Returns:
an
NM.SettingVlanif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingVlanthe connection might contain.
- get_setting_vpn()¶
- Returns:
an
NM.SettingVpnif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingVpnthe connection might contain.
- get_setting_vxlan()¶
- Returns:
an
NM.SettingVxlanif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingVxlanthe connection might contain.New in version 1.2.
- get_setting_wimax()¶
- Returns:
an
NM.SettingWimaxif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingWimaxthe connection might contain.
- get_setting_wired()¶
- Returns:
an
NM.SettingWiredif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingWiredthe connection might contain.
- get_setting_wireless()¶
- Returns:
an
NM.SettingWirelessif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingWirelessthe connection might contain.
- get_setting_wireless_security()¶
- Returns:
an
NM.SettingWirelessSecurityif the connection contains one, otherwiseNone- Return type:
A shortcut to return any
NM.SettingWirelessSecuritythe connection might contain.
- get_settings()¶
- Returns:
a
None-terminated array containing every setting of self. If the connection has no settings,Noneis returned.- Return type:
[
NM.Setting] orNone
Retrieves the settings in self.
The returned array is
None-terminated.New in version 1.10.
- get_uuid()¶
- Returns:
the UUID from the connection’s ‘connection’ setting
- Return type:
A shortcut to return the UUID from the connection’s
NM.SettingConnection.
- get_virtual_device_description()¶
- Returns:
the name of self's device, or
Noneif self is not a virtual connection type- Return type:
Returns the name that
NM.Device.disambiguate_names() would return for the virtual device that would be created for self. Eg, “VLAN (eth1.1)”.
- is_type(type)¶
- Parameters:
type (
str) – a setting name to check the connection’s type against (likeNM.SETTING_WIRELESS_SETTING_NAMEorNM.SETTING_WIRED_SETTING_NAME)- Returns:
- Return type:
A convenience function to check if the given self is a particular type (ie wired, Wi-Fi, ppp, etc). Checks the
NM.SettingConnection:typeproperty of the connection and matches that against type.
- is_virtual()¶
- Returns:
whether self refers to a virtual device
- Return type:
Checks if self refers to a virtual device (and thus can potentially be activated even if the device it refers to doesn’t exist).
- need_secrets()¶
- Returns:
the setting name of the
NM.Settingobject which has invalid or missing secrets- hints:
the address of a pointer to a
GLib.PtrArray, initialized toNone, which on return points to an allocatedGLib.PtrArraycontaining the property names of secrets of theNM.Settingwhich may be required; the caller owns the array and must free the array itself with g_ptr_array_free(), but not free its elements
- Return type:
Returns the name of the first setting object in the connection which would need secrets to make a successful connection. The returned hints are only intended as a guide to what secrets may be required, because in some circumstances, there is no way to conclusively determine exactly which secrets are needed.
- normalize(parameters)¶
- Parameters:
parameters ({
str:object} orNone) – aGLib.HashTablewith normalization parameters to allow customization of the normalization by providing specific arguments. Unknown arguments will be ignored and the default will be used. The keys must be strings compared withGLib.str_equal() function. The values are opaque and depend on the parameter name.- Raises:
- Returns:
Trueif the connection is valid,Falseif it is not- modified:
outputs whether any settings were modified.
- Return type:
Does some basic normalization and fixup of well known inconsistencies and deprecated fields. If the connection was modified in any way, the output parameter modified is set
True.Finally the connection will be verified and
Truereturns if the connection is valid. As this function only performs some specific normalization steps it cannot repair all connections. If the connection has errors that cannot be normalized, the connection will not be modified.
- remove_setting(setting_type)¶
- Parameters:
setting_type (
GObject.GType) – theGObject.GTypeof the setting object to remove
Removes the
NM.Settingwith the givenGObject.GTypefrom theNM.Connection. This operation dereferences theNM.Settingobject.
- replace_settings(new_settings)¶
- Parameters:
new_settings (
GLib.Variant) – aGLib.Variantof type %NM_VARIANT_TYPE_CONNECTION, with the new settings- Raises:
- Returns:
Trueif connection was updated,Falseif new_settings could not be deserialized (in which case self will be unchanged).- Return type:
Replaces self's settings with new_settings (which must be syntactically valid, and describe a known type of connection, but does not need to result in a connection that passes
NM.Connection.verify()).
- replace_settings_from_connection(new_connection)¶
- Parameters:
new_connection (
NM.Connection) – aNM.Connectionto replace the settings of self with
Deep-copies the settings of new_connection and replaces the settings of self with the copied settings.
- set_path(path)¶
- Parameters:
path (
str) – the D-Bus path of the connection as given by the settings service which provides the connection
Sets the D-Bus path of the connection. This property is not serialized, and is only for the reference of the caller. Sets the
NM.Connection:pathproperty.
- to_dbus(flags)¶
- Parameters:
flags (
NM.ConnectionSerializationFlags) – serialization flags, e.g.NM.ConnectionSerializationFlags.ALL- Returns:
a new floating
GLib.Variantdescribing the connection, its settings, and each setting’s properties.- Return type:
Converts the
NM.Connectioninto aGLib.Variantof type %NM_VARIANT_TYPE_CONNECTION describing the connection, suitable for marshalling over D-Bus or otherwise serializing.
- update_secrets(setting_name, secrets)¶
- Parameters:
setting_name (
str) – the setting object name to which the secrets applysecrets (
GLib.Variant) – aGLib.Variantof secrets, of type %NM_VARIANT_TYPE_CONNECTION or %NM_VARIANT_TYPE_SETTING
- Raises:
- Returns:
Trueif the secrets were successfully updated,Falseif the update failed (tried to update secrets for a setting that doesn’t exist, etc)- Return type:
Update the specified setting’s secrets, given a dictionary of secrets intended for that setting (deserialized from D-Bus for example). Will also extract the given setting’s secrets hash if given a connection dictionary. If setting_name is
None, expects a fully serializedNM.Connectionas returned byNM.Connection.to_dbus() and will update all secrets from all settings contained in secrets.
- verify()¶
- Raises:
- Returns:
- Return type:
Validates the connection and all its settings. Each setting’s properties have allowed values, and some values are dependent on other values. For example, if a Wi-Fi connection is security enabled, the
NM.SettingWirelesssetting object’s ‘security’ property must contain the setting name of theNM.SettingWirelessSecurityobject, which must also be present in the connection for the connection to be valid. As another example, theNM.SettingWiredobject’s ‘mac-address’ property must be a validly formatted MAC address. The returnedGLib.Errorcontains information about which setting and which property failed validation, and how it failed validation.
- verify_secrets()¶
- Raises:
- Returns:
- Return type:
Verifies the secrets in the connection.
New in version 1.2.
- do_changed() virtual¶
emitted when any change to the connection’s settings occurs
- do_secrets_cleared() virtual¶
emitted when the connection’s secrets are cleared
Signal Details¶
- NM.Connection.signals.changed(connection)¶
- Signal Name:
changed- Flags:
- Parameters:
connection (
NM.Connection) – The object which received the signal
The
::changedsignal is emitted when any property (including secrets) of any setting of the connection is modified, or when settings are added or removed.
- NM.Connection.signals.secrets_cleared(connection)¶
- Signal Name:
secrets-cleared- Flags:
- Parameters:
connection (
NM.Connection) – The object which received the signal
The
::secrets-clearedsignal is emitted when the secrets of a connection are cleared.
- NM.Connection.signals.secrets_updated(connection, setting_name)¶
- Signal Name:
secrets-updated- Flags:
- Parameters:
connection (
NM.Connection) – The object which received the signalsetting_name (
str) – the setting name of theNM.Settingfor which secrets were updated
The
::secrets-updatedsignal is emitted when the secrets of a setting have been changed.