2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-15 14:17:18 +00:00
Commit Graph

12 Commits

Author SHA1 Message Date
Ethan Jackson
3a656eafb9 python: Upgrade to vlog.
This patch upgrades the library code in the python/ovs directory to
the new vlog module.
2011-09-27 14:51:49 -07:00
Ethan Jackson
26bb0f3129 python: Style cleanup.
This patch does minor style cleanups to the code in the python and
tests directory.  There's other code floating around that could use
similar treatment, but updating it is not convenient at the moment.
2011-09-24 16:32:54 -07:00
Ben Pfaff
8cdf034974 python: Implement write support in Python IDL for OVSDB.
Until now, the Python bindings for OVSDB have not supported writing to the
database.  Instead, writes had to be done with "ovs-vsctl" subprocesses.
This commit adds write support and brings the Python bindings in line with
the C bindings.

This commit deletes the Python-specific IDL tests in favor of using the
same tests as the C version of the IDL, which now pass with both
implementations.

This commit updates the two users of the Python IDL to use the new write
support.  I tested this updates only by writing unit tests for them,
which appear in upcoming commits.
2011-09-23 14:23:16 -07:00
Ben Pfaff
49c541dc11 ovs.ovsuuid: Get rid of ovs.ovsuuid.UUID class.
This class only caused unnecessary confusion.  This commit changes all of
its methods into top-level functions.
2011-09-23 09:10:45 -07:00
Ben Pfaff
7550c333d3 ovs.db.idl: Fix error message format arguments.
There's no variable table_name.

Found by pychecker.
2011-08-25 11:07:23 -07:00
Ben Pfaff
af1eba26c3 ovs.db.idl: Fix call to ovs.db.parser.Parser constructor.
This bug was introduced by commit 4c0f62718f "ovs.db.idl: Improve error
reporting for bad <row-update>s."

Found by pychecker.
Bug #7006.
2011-08-25 11:06:53 -07:00
Ben Pfaff
bf6ec045b7 ovs.db.idl: Use top-level class to represent IDL rows.
According to Reid, there may be some disadvantages to having this class be
anonymous, for example, cannot do instance/typechecking, might be
allocating a new class for every row as well, which isn't the most memory
efficient.

Suggested-by: Reid Price <reid@nicira.com>
2011-08-24 11:57:43 -07:00
Ben Pfaff
7d48f8f8bd ovs.db.idl: Actually use Idl.__modify_row()'s return value.
Idl.__parse_row_update() assumed that every change that the database server
sent down actually modified the database.  This is generally true, but
since Idl.__modify_row() already returns whether there was a change, we
might as well use it.

Reported-by: Reid Price <reid@nicira.com>
2011-08-24 11:57:43 -07:00
Ben Pfaff
4c0f62718f ovs.db.idl: Improve error reporting for bad <row-update>s.
Strangely malformed <row-update>s could hypothetically get confusing error
message.  Using the Parser class should avoid that.

Reported-by: Reid Price <reid@nicira.com>
2011-08-24 11:57:43 -07:00
Ben Pfaff
f2d8ad13e1 python: Avoid lots of \" in quoted strings by using '' as outermost quotes.
Suggested-by: Reid Price <reid@nicira.com>
2011-08-24 11:57:42 -07:00
Ben Pfaff
523a3bc773 python: Use getattr() and setattr() instead of __dict__.
This leaves one use of __dict__ used for iterating through attributes.
I could use dir() instead, but I was put off by this note in its
documentation in the Python Library Reference:

    Because dir() is supplied primarily as a convenience for use at an
    interactive prompt, it tries to supply an interesting set of names more
    than it tries to supply a rigorously or consistently defined set of names,
    and its detailed behavior may change across releases.  For example,
    metaclass attributes are not in the result list when the argument is a
    class.

Suggested-by: Reid Price <reid@nicira.com>
2011-08-24 11:57:42 -07:00
Ben Pfaff
991559357f Implement initial Python bindings for Open vSwitch database.
These initial bindings pass a few hundred of the corresponding tests
for C implementations of various bits of the Open vSwitch library API.
The poorest part of them is actually the Python IDL interface in
ovs.db.idl, which has not received enough attention yet.  It appears
to work, but it doesn't yet support writes (transactions) and it is
difficult to use.  I hope to improve it as it becomes clear what
semantics Python applications actually want from an IDL.
2010-08-25 14:55:48 -07:00