2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-23 14:57:06 +00:00
Commit Graph

20 Commits

Author SHA1 Message Date
Russell Bryant
cb96c1b27e python: Convert dict iterators.
In Python 2, dict.items(), dict.keys(), and dict.values() returned a
list.  dict.iteritems(), dict.iterkeys(), and dict.itervalues() returned
an iterator.

As of Python 3, dict.iteritems(), dict.itervalues(), and dict.iterkeys()
are gone.  items(), keys(), and values() now return an iterator.

In the case where we want an iterator, we now use the six.iter*()
helpers.  If we want a list, we explicitly create a list from the
iterator.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
2016-01-21 23:00:11 -05:00
Ben Pfaff
c70a77673c ovsdb: Remove SPECS in favor of referring to RFC 7047.
Also, add some clarifications relative to RFC 7047 to ovsdb-server(1).

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
2014-04-04 13:51:32 -07:00
Andy Hill
ec9f40dce1 Fix misspellings in comments and docs.
Flagged with: https://github.com/lyda/misspell-check
Run with: git ls-files | misspellings -f -

Signed-off-by: Andy Hill <hillad@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-06-04 21:53:33 -07:00
Raju Subramanian
e0edde6fee Global replace of Nicira Networks.
Replaced all instances of Nicira Networks(, Inc) to Nicira, Inc.

Feature #10593
Signed-off-by: Raju Subramanian <rsubramanian@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-05-02 17:08:02 -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
5c3a4660c0 python: Accept multiple forms of strings and lists when parsing JSON.
The JSON parser in OVS always yields unicode strings and lists, never
non-unicode strings or tuples, but it's easy to create them when building
JSON elsewhere, so accept both forms.
2011-09-23 09:10:45 -07:00
Ben Pfaff
843fb01b61 python: Change 'clone' function names to 'copy'.
It seems that 'copy' is the proper name for this kind of function in
Python, based on the existence of dict.copy().
2011-09-23 09:10:45 -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
9e4f0157ec ovs.db.data: Make Datum.check_constraints() work.
This code never got tested and so didn't work.

This does not fix an actual bug because Datum.check_constraints() does not
have any existing users.
2011-09-23 09:10:44 -07:00
Ben Pfaff
cf5404f67d ovs.db.data: Fix Atom.new()'s handling of Boolean values.
Boolean values have Boolean type, not real type.

This does not fix an actual bug because Atom.new() does not have existing
users.
2011-09-23 09:10:44 -07:00
Ben Pfaff
973d7411d6 python: Remove unused imports.
Found by pychecker.
2011-08-25 11:07:23 -07:00
Ben Pfaff
367da73833 python: Use enumerate() builtin function to simplify counted iteration.
Suggested-by: Reid Price <reid@nicira.com>
2011-08-24 12:06:53 -07:00
Ben Pfaff
6a6f8d1673 ovsdb-data: Simplify converting an OVSDB datum to JSON by reordering logic.
Putting the "map" case first avoids duplicate tests.

Suggested-by: Reid Price <reid@nicira.com>
2011-08-24 11:57:42 -07:00
Ben Pfaff
8758e8a373 python: Avoid using 'type' as a variable name.
'type' is a Python built-in function, so it's best to avoid using it as
a variable name.

Reported-by: Reid Price <reid@nicira.com>
2011-08-24 11:57:42 -07:00
Ben Pfaff
d272c10ecd python: Take advantage of Python "x < y < z" syntax.
Suggested-by: Reid Price <reid@nicira.com>
2011-08-24 11:57:42 -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
b33a04c63a python: Join a list of strings instead of concatenating a long string.
Python does not do a good job of appending strings: it takes O(n**2) time
to append n strings.

Suggested-by: Reid Price <reid@nicira.com>
2011-08-24 11:57:42 -07:00
Ben Pfaff
57d6a4c71b ovs.db.data: Fix bugs in Atom.is_default() and Datum.is_default().
Reported-by: Reid Price <reid@nicira.com>
2011-08-24 11:57:14 -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