Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python.announce > #2131 > unrolled thread

pyroute2 release 0.4.0

Started by"Peter V. Saveliev" <peter@svinota.eu>
First post2016-05-08 15:32 +0200
Last post2016-05-08 15:32 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python.announce

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  pyroute2 release 0.4.0 "Peter V. Saveliev" <peter@svinota.eu> - 2016-05-08 15:32 +0200

#2131 — pyroute2 release 0.4.0

From"Peter V. Saveliev" <peter@svinota.eu>
Date2016-05-08 15:32 +0200
Subjectpyroute2 release 0.4.0
Message-ID<mailman.511.1462714426.32212.python-announce-list@python.org>
pyroute2-0.4.0
--------------

An important release [1] of the most comprehensive Python netlink library.

description
===========

The library is focused on RTNL (though supports other netlink protocols 
as well):

* Interfaces: bridge, bond, vlan, vxlan, vrf, veth, gre, ...
* Bridge vlan filters
* Routes: metrics, multipath, ...
* AF_MPLS routes and MPLS lwtunnel [2]
* Neighbours cache management
* Traffic controls: HTB, TBF, ...
* BPF support [3]
...
* Basic support: nftables, ipset, nl80211, taskstats, ...
...
* Netns support (not via netlink :)


socket level
============

On the low level the library provides socket-like objects. They support 
all the normal socket methods like `sendmsg()`, `recv()`, `fileno()`, 
can be used in `poll()`/`select()`. But they also provide utility 
functions that implement specific protocol features, e.g.:

`IPRoute`:
* `link()` -- manage network interfaces,
* `addr()` -- ... addresses,
* `route()` -- ... routes,
...

`IPSet`:
* `list()`
* `create()`
* `destroy()`
...

`IW`:
* `scan()`
* `connect()`
* `join_ibss()`
...

See more details in docs [4]

ipdb
====

For the RTNL protocol the library provides also IPDB, a transactional 
database. Instead of polling the system and loading all the objects, 
IPDB relies on the netlink broadcasting. Every time some network object 
changes its state, the event is being propagated by the kernel. So 
despite the IPDB startup may be expensive (at that time it loads all the 
system info), for the long-running programs it gives significant 
performance improvement, providing fast cache of the network objects. It 
is important when there are hundreds and thousands of routes, 
neighbours, addresses etc.

All the changes made via IPDB are tracked and asserted; running any code 
after the `commit()` call you can be sure that it works in the system 
with certain settings. If IPDB meets some issues running `commit()`, it 
rolls back all the changes made in the transaction and raises an exception::

     with IPDB() as ipdb:
         #
         # assume here eth0 is down, w/o ipaddr, mtu == 1500
         #
	with ipdb.interfaces['eth0'] as i:
             i.add_ip('10.0.0.2/24')
             i.up()
             i.set_mtu(1460)
             i.set_address('00:11:22:33:44:55')
         #
         # here eth0 will be up AND with ipaddr AND with new macaddr
         # AND with mtu 1460
         #
         # if something goes wrong, all the eth0 settings will be
         # reverted to the last working state
         #


references
==========

Project home: https://github.com/svinota/pyroute2

Also in the text:

[1] https://pypi.python.org/pypi/pyroute2
[2] http://docs.pyroute2.org/mpls.html
[3] in cooperation with https://github.com/iovisor/bcc
[4] http://docs.pyroute2.org/usage.html

[toc] | [standalone]


Back to top | Article view | comp.lang.python.announce


csiph-web