NM.IPRoute¶
Fields¶
None
Methods¶
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class NM.IPRoute¶
- classmethod attribute_validate(name, value, family)¶
- Parameters:
name (
str
) – the attribute namevalue (
GLib.Variant
) – the attribute valuefamily (
int
) – IP address family of the route
- Raises:
- Returns:
True
if the attribute is valid,False
otherwise- known:
on return, whether the attribute name is a known one
- Return type:
Validates a route attribute, i.e. checks that the attribute is a known one and the value is of the correct type and well-formed.
New in version 1.8.
- classmethod get_variant_attribute_spec()¶
- Returns:
the specifiers for route attributes
- Return type:
New in version 1.8.
- classmethod new(family, dest, prefix, next_hop, metric)¶
- Parameters:
- Raises:
- Returns:
the new
NM.IPRoute
object, orNone
on error- Return type:
Creates a new
NM.IPRoute
object.
- classmethod new_binary(family, dest, prefix, next_hop, metric)¶
- Parameters:
- Raises:
- Returns:
the new
NM.IPRoute
object, orNone
on error- Return type:
Creates a new
NM.IPRoute
object. dest and next_hop (if non-None
) must point to buffers of the correct size for family.
- dup()¶
- Returns:
a copy of self
This API was part of public headers before 1.32.0 but was erroneously not exported in the ABI. It is thus only usable since 1.32.0.
- Return type:
Creates a copy of self
New in version 1.32.
- equal(other)¶
- Parameters:
other (
NM.IPRoute
) – theNM.IPRoute
to compare self to.- Returns:
True
if the objects contain the same values,False
if they do not.- Return type:
Determines if two
NM.IPRoute
objects contain the same destination, prefix, next hop, and metric. (Attributes are not compared.)
- equal_full(other, cmp_flags)¶
- Parameters:
other (
NM.IPRoute
) – theNM.IPRoute
to compare self to.cmp_flags (
int
) – tune how to compare attributes. Currently, only NM_IP_ROUTE_EQUAL_CMP_FLAGS_NONE (0) and NM_IP_ROUTE_EQUAL_CMP_FLAGS_WITH_ATTRS (1) is supported.
- Returns:
True
if the objects contain the same values,False
if they do not.- Return type:
Determines if two
NM.IPRoute
objects contain the same destination, prefix, next hop, and metric.New in version 1.10.
- get_attribute(name)¶
- Parameters:
name (
str
) – the name of an route attribute- Returns:
the value of the attribute with name name on self, or
None
if self has no such attribute.- Return type:
Gets the value of the attribute with name name on self
- get_attribute_names()¶
-
Gets an array of attribute names defined on self.
- get_dest()¶
- Returns:
the IP address of the route’s destination
- Return type:
Gets the IP destination address property of this route object.
- get_family()¶
- Returns:
the IP address family
- Return type:
Gets the IP address family (eg, AF_INET) property of this route object.
- get_metric()¶
- Returns:
the route metric
- Return type:
Gets the route metric property of this route object; lower values indicate “better” or more preferred routes; -1 indicates “default” (meaning NetworkManager will set it appropriately).
- get_next_hop()¶
-
Gets the IP address of the next hop of this route; this will be
None
if the route has no next hop.
- get_prefix()¶
- Returns:
the IP prefix
- Return type:
Gets the IP prefix (ie “24” or “30” etc) of this route.
- ref()¶
Increases the reference count of the object.
- set_attribute(name, value)¶
- Parameters:
name (
str
) – the name of a route attributevalue (
GLib.Variant
orNone
) – the value
Sets the named attribute on self to the given value.
- set_dest(dest)¶
- Parameters:
dest (
str
) – the route’s destination, as a string
Sets the destination property of this route object.
dest must be a valid address of self's family. If you aren’t sure you have a valid address, use nm_inet_is_valid() to check it.
- set_metric(metric)¶
- Parameters:
metric (
int
) – the route metric (or -1 for “default”)
Sets the metric property of this route object.
- set_next_hop(next_hop)¶
-
Sets the next-hop property of this route object.
next_hop (if non-
None
) must be a valid address of self's family. If you aren’t sure you have a valid address, useNM.utils_ipaddr_valid
() to check it.
- set_prefix(prefix)¶
- Parameters:
prefix (
int
) – the route prefix
Sets the prefix property of this route object.
- unref()¶
Decreases the reference count of the object. If the reference count reaches zero, the object will be destroyed.