| 1 |
================= |
| 2 |
Network Addresses |
| 3 |
================= |
| 4 |
|
| 5 |
The **Address** module provides access to the network address configuration |
| 6 |
of the kernel. It provides an interface to fetch all configured addresses, |
| 7 |
add new addresses and to delete existing addresses. |
| 8 |
|
| 9 |
Fetching the list of network addresses is achieved by creating a new |
| 10 |
address cache:: |
| 11 |
|
| 12 |
import netlink.route.address as Address |
| 13 |
|
| 14 |
addr_cache = Address.AddressCache() |
| 15 |
addr_cache.refill() |
| 16 |
|
| 17 |
for addr in addr_cache: |
| 18 |
print addr |
| 19 |
|
| 20 |
.. py:module:: netlink.route.addr |
| 21 |
|
| 22 |
|
| 23 |
AddressCache |
| 24 |
------------ |
| 25 |
|
| 26 |
.. py:class:: AddressCache |
| 27 |
|
| 28 |
Represents a cache containing all or a subset of network addresses. |
| 29 |
|
| 30 |
.. py:method:: lookup(ifindex, local) |
| 31 |
|
| 32 |
Lookup the address which matches ifindex and local address |
| 33 |
|
| 34 |
:raises: KeyError if address is not found. |
| 35 |
|
| 36 |
Address |
| 37 |
------- |
| 38 |
|
| 39 |
.. py:class:: Address |
| 40 |
|
| 41 |
Representation of a configured network address. |
| 42 |
|
| 43 |
.. py:attribute:: ifindex |
| 44 |
|
| 45 |
Interface index |
| 46 |
|
| 47 |
:rtype: int |