route_addr.rst 1004 B

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