NM.SettingBond

g GObject.Object GObject.Object NM.Setting NM.Setting GObject.Object->NM.Setting NM.SettingBond NM.SettingBond NM.Setting->NM.SettingBond

Subclasses:

None

Methods

Inherited:

NM.Setting (21), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

class

validate_option (name, value)

add_option (name, value)

get_num_options ()

get_option (idx)

get_option_by_name (name)

get_option_default (name)

get_option_normalized (name)

get_valid_options ()

remove_option (name)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Inherited:

NM.Setting (1)

Name

Type

Flags

Short Description

options

GLib.HashTable

r/w

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class NM.SettingBond(**kwargs)
Bases:

NM.Setting

Abstract:

No

Structure:

NM.SettingBondClass

Bonding Settings

classmethod new()
Returns:

the new empty NM.SettingBond object

Return type:

NM.Setting

Creates a new NM.SettingBond object with default values.

classmethod validate_option(name, value)
Parameters:
  • name (str) – the name of the option to validate

  • value (str or None) – the value of the option to validate.

Returns:

True, if the value is valid for the given name. If the name is not a valid option, False will be returned.

Return type:

bool

Checks whether name is a valid bond option and value is a valid value for the name. If value is None, the function only validates the option name.

add_option(name, value)
Parameters:
  • name (str) – name for the option

  • value (str) – value for the option

Returns:

returns False if either name or value is None, in that case the option is not set. Otherwise, the function does not fail and does not validate the arguments. All validation happens via NM.Connection.verify() or do basic validation yourself with NM.SettingBond.validate_option().

Note: Before 1.30, libnm would perform basic validation of the name and the value via NM.SettingBond.validate_option() and reject the request by returning False. Since 1.30, libnm no longer rejects any values as the setter is not supposed to perform validation.

Return type:

bool

Add an option to the table. Adding a new name replaces any existing name/value pair that may already exist.

get_num_options()
Returns:

the number of bonding options

Return type:

int

Returns the number of options that should be set for this bond when it is activated. This can be used to retrieve each option individually using NM.SettingBond.get_option().

get_option(idx)
Parameters:

idx (int) – index of the desired option, from 0 to NM.SettingBond.get_num_options() - 1

Returns:

True on success if the index was valid and an option was found, False if the index was invalid (ie, greater than the number of options currently held by the setting)

out_name:

on return, the name of the bonding option; this value is owned by the setting and should not be modified

out_value:

on return, the value of the name of the bonding option; this value is owned by the setting and should not be modified

Return type:

(bool, out_name: str, out_value: str)

Given an index, return the value of the bonding option at that index. Indexes are *not* guaranteed to be static across modifications to options done by NM.SettingBond.add_option() and NM.SettingBond.remove_option(), and should not be used to refer to options except for short periods of time such as during option iteration.

get_option_by_name(name)
Parameters:

name (str) – the option name for which to retrieve the value

Returns:

the value, or None if the key/value pair was never added to the setting; the value is owned by the setting and must not be modified

Return type:

str

Returns the value associated with the bonding option specified by name, if it exists.

get_option_default(name)
Parameters:

name (str) – the name of the option

Returns:

the value of the bond option if not overridden by an entry in the NM.SettingBond :options property.

Return type:

str

get_option_normalized(name)
Parameters:

name (str) – the name of the option

Returns:

the value of the bond option after normalization, which is what NetworkManager will actually apply when activating the connection. None if the option won’t be applied to the connection.

Return type:

str

New in version 1.24.

get_valid_options()
Returns:

a None-terminated array of strings of valid bond options.

Return type:

[str] or None

Returns a list of valid bond options.

The self argument is unused and may be passed as None.

remove_option(name)
Parameters:

name (str) – name of the option to remove

Returns:

True if the option was found and removed from the internal option list, False if it was not.

Return type:

bool

Remove the bonding option referenced by name from the internal option list.

Property Details

NM.SettingBond.props.options
Name:

options

Type:

GLib.HashTable

Default Value:

None

Flags:

READABLE, WRITABLE

Dictionary of key/value pairs of bonding options. Both keys and values must be strings. Option names must contain only alphanumeric characters (ie, [a-zA-Z0-9]).