<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/openvswitch.git/python, branch branch-2.5</title>
<subtitle>github.com: openvswitch/ovs.git
</subtitle>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openvswitch.git/'/>
<entry>
<title>python: Escape backslashes while formatting logs.</title>
<updated>2019-01-15T17:12:59+00:00</updated>
<author>
<name>Ilya Maximets</name>
<email>i.maximets@samsung.com</email>
</author>
<published>2019-01-15T14:03:00+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openvswitch.git/commit/?id=79b7778006cb26f972339f0ccd34ddd0ca1edff8'/>
<id>79b7778006cb26f972339f0ccd34ddd0ca1edff8</id>
<content type='text'>
Since python version 3.7 (and some 3.6+ versions) regexp engine
changed to treat the wrong escape sequences as errors. Previously,
if the replace string had something like '\u0000', '\u' was
qualified as a bad escape sequence and treated just as a sequence
of characters '\' and 'u'. But know this triggers an error:

  Traceback (most recent call last):
    File "/usr/lib/python3.7/sre_parse.py", line 1021, in parse_template
      this = chr(ESCAPES[this][1])
  KeyError: '\\u'

From the documentation [1]:

  Unknown escapes consisting of '\' and an ASCII letter in replacement
  templates for re.sub() were deprecated in Python 3.5, and will now
  cause an error.

[1] https://docs.python.org/3/whatsnew/3.7.html#api-and-feature-removals

We need to escape the backslash by another one to keep regexp engine
from errors. In case of '\\u000', '\\' is a valid escape sequence
and the 'u' is a simple character.

To be 100% safe we need to use 're.escape(replace)', but it escapes
too many characters making the logs hard to read.

This change fixes Python 3 tests on systems with python 3.7.
Should be backward compatible.

Reported-by: Ben Pfaff &lt;blp@ovn.org&gt;
Signed-off-by: Ilya Maximets &lt;i.maximets@samsung.com&gt;
Signed-off-by: Ben Pfaff &lt;blp@ovn.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since python version 3.7 (and some 3.6+ versions) regexp engine
changed to treat the wrong escape sequences as errors. Previously,
if the replace string had something like '\u0000', '\u' was
qualified as a bad escape sequence and treated just as a sequence
of characters '\' and 'u'. But know this triggers an error:

  Traceback (most recent call last):
    File "/usr/lib/python3.7/sre_parse.py", line 1021, in parse_template
      this = chr(ESCAPES[this][1])
  KeyError: '\\u'

From the documentation [1]:

  Unknown escapes consisting of '\' and an ASCII letter in replacement
  templates for re.sub() were deprecated in Python 3.5, and will now
  cause an error.

[1] https://docs.python.org/3/whatsnew/3.7.html#api-and-feature-removals

We need to escape the backslash by another one to keep regexp engine
from errors. In case of '\\u000', '\\' is a valid escape sequence
and the 'u' is a simple character.

To be 100% safe we need to use 're.escape(replace)', but it escapes
too many characters making the logs hard to read.

This change fixes Python 3 tests on systems with python 3.7.
Should be backward compatible.

Reported-by: Ben Pfaff &lt;blp@ovn.org&gt;
Signed-off-by: Ilya Maximets &lt;i.maximets@samsung.com&gt;
Signed-off-by: Ben Pfaff &lt;blp@ovn.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>python: Catch setsockopt exceptions for TCP stream.</title>
<updated>2018-12-20T18:12:21+00:00</updated>
<author>
<name>Ilya Maximets</name>
<email>i.maximets@samsung.com</email>
</author>
<published>2018-12-20T17:35:57+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openvswitch.git/commit/?id=5078ae8bb9cbe5a3d9575be87475ecd0e63ce328'/>
<id>5078ae8bb9cbe5a3d9575be87475ecd0e63ce328</id>
<content type='text'>
'sock.setsockopt' could throw exceptions. For example, if non-blocking
connection failed before the call:

  Traceback (most recent call last):
    File "../.././test-ovsdb.py", line 896, in &lt;module&gt;
      main(sys.argv)
    File "../.././test-ovsdb.py", line 891, in main
      func(*args)
    File "../.././test-ovsdb.py", line 604, in do_idl
      ovs.stream.Stream.open(r))
    File "/root/git_/ovs/python/ovs/stream.py", line 190, in open
      error, sock = cls._open(suffix, dscp)
    File "/root/git_/ovs/python/ovs/stream.py", line 744, in _open
      sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
    File "/usr/local/lib/python2.7/socket.py", line 228, in meth
      return getattr(self._sock,name)(*args)
  socket.error: [Errno 54] Connection reset by peer

This fixes tests on FreeBSD.

Signed-off-by: Ilya Maximets &lt;i.maximets@samsung.com&gt;
Signed-off-by: Ben Pfaff &lt;blp@ovn.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
'sock.setsockopt' could throw exceptions. For example, if non-blocking
connection failed before the call:

  Traceback (most recent call last):
    File "../.././test-ovsdb.py", line 896, in &lt;module&gt;
      main(sys.argv)
    File "../.././test-ovsdb.py", line 891, in main
      func(*args)
    File "../.././test-ovsdb.py", line 604, in do_idl
      ovs.stream.Stream.open(r))
    File "/root/git_/ovs/python/ovs/stream.py", line 190, in open
      error, sock = cls._open(suffix, dscp)
    File "/root/git_/ovs/python/ovs/stream.py", line 744, in _open
      sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
    File "/usr/local/lib/python2.7/socket.py", line 228, in meth
      return getattr(self._sock,name)(*args)
  socket.error: [Errno 54] Connection reset by peer

This fixes tests on FreeBSD.

Signed-off-by: Ilya Maximets &lt;i.maximets@samsung.com&gt;
Signed-off-by: Ben Pfaff &lt;blp@ovn.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>python: Fix the TypeError exception seen when idl.Idl parses lock reply</title>
<updated>2016-01-08T14:56:22+00:00</updated>
<author>
<name>Numan Siddique</name>
<email>nusiddiq@redhat.com</email>
</author>
<published>2016-01-08T06:29:47+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openvswitch.git/commit/?id=c419fc89bcb70cc0fe5adb132fd4b20ee76e36bc'/>
<id>c419fc89bcb70cc0fe5adb132fd4b20ee76e36bc</id>
<content type='text'>
File "/usr/lib/python2.7/site-packages/ovs/db/idl.py", line 334,
in __parse_lock_notify
  self.__update_has_lock(self, new_has_lock)
TypeError: __update_has_lock() takes exactly 2 arguments (3 given)

Signed-off-by: Numan Siddique &lt;nusiddiq@redhat.com&gt;
Signed-off-by: Russell Bryant &lt;russell@ovn.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
File "/usr/lib/python2.7/site-packages/ovs/db/idl.py", line 334,
in __parse_lock_notify
  self.__update_has_lock(self, new_has_lock)
TypeError: __update_has_lock() takes exactly 2 arguments (3 given)

Signed-off-by: Numan Siddique &lt;nusiddiq@redhat.com&gt;
Signed-off-by: Russell Bryant &lt;russell@ovn.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ovsdb-idl: Support for readonly columns that are fetched on-demand</title>
<updated>2015-11-23T16:34:54+00:00</updated>
<author>
<name>Shad Ansari</name>
<email>shad.ansari@hp.com</email>
</author>
<published>2015-10-22T21:35:24+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openvswitch.git/commit/?id=80c12152f30b0598a36198d9ec67a85f2357e623'/>
<id>80c12152f30b0598a36198d9ec67a85f2357e623</id>
<content type='text'>
There is currently no mechanism in IDL to fetch specific column values
on-demand without having to register them for monitoring. In the case
where the column represent a frequently changing entity (e.g. counter),
and the reads are relatively infrequent (e.g. CLI client), there is a
significant overhead in replication.

This patch adds support in the Python IDL to register a subset of the
columns of a table as "readonly". Readonly columns are not replicated.
Users may "fetch" the readonly columns of a row on-demand. Once fetched,
the columns are not updated until the next fetch by the user. Writes by
the user to readonly columns does not change the value (both locally or
on the server).

The two main user visible changes in this patch are:
  - The SchemaHelper.register_columns() method now takes an optionaly
    argument to specify the subset of readonly column(s)
  - A new Row.fetch(columns) method to fetch values of readonly columns(s)

Usage:
------

    # Schema file includes all columns, including readonly
    schema_helper = ovs.db.idl.SchemaHelper(schema_file)

    # Register interest in columns with 'r' and 's' as readonly
    schema_helper.register_columns("simple", [i, r, s], [r, s])

    # Create Idl and jsonrpc, and wait for update, as usual
    ...

    # Fetch value of column 'r' for a specific row
    row.fetch('r')
    txn.commit_block()

    print row.r
    print getattr(row, 'r')

    # Writing to readonly column has no effect (locally or on server)
    row.r = 3
    print row.r     # prints fetched value not 3

Signed-off-by: Shad Ansari &lt;shad.ansari@hp.com&gt;
Signed-off-by: Ben Pfaff &lt;blp@ovn.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There is currently no mechanism in IDL to fetch specific column values
on-demand without having to register them for monitoring. In the case
where the column represent a frequently changing entity (e.g. counter),
and the reads are relatively infrequent (e.g. CLI client), there is a
significant overhead in replication.

This patch adds support in the Python IDL to register a subset of the
columns of a table as "readonly". Readonly columns are not replicated.
Users may "fetch" the readonly columns of a row on-demand. Once fetched,
the columns are not updated until the next fetch by the user. Writes by
the user to readonly columns does not change the value (both locally or
on the server).

The two main user visible changes in this patch are:
  - The SchemaHelper.register_columns() method now takes an optionaly
    argument to specify the subset of readonly column(s)
  - A new Row.fetch(columns) method to fetch values of readonly columns(s)

Usage:
------

    # Schema file includes all columns, including readonly
    schema_helper = ovs.db.idl.SchemaHelper(schema_file)

    # Register interest in columns with 'r' and 's' as readonly
    schema_helper.register_columns("simple", [i, r, s], [r, s])

    # Create Idl and jsonrpc, and wait for update, as usual
    ...

    # Fetch value of column 'r' for a specific row
    row.fetch('r')
    txn.commit_block()

    print row.r
    print getattr(row, 'r')

    # Writing to readonly column has no effect (locally or on server)
    row.r = 3
    print row.r     # prints fetched value not 3

Signed-off-by: Shad Ansari &lt;shad.ansari@hp.com&gt;
Signed-off-by: Ben Pfaff &lt;blp@ovn.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>nroff: Add support for &lt;b&gt;...&lt;/b&gt; and &lt;i&gt;...&lt;/i&gt; inline markup.</title>
<updated>2015-09-29T23:57:09+00:00</updated>
<author>
<name>Ben Pfaff</name>
<email>blp@nicira.com</email>
</author>
<published>2015-09-17T17:10:56+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openvswitch.git/commit/?id=08258b507a5f8c0b3c415c0ae512e70139aff685'/>
<id>08258b507a5f8c0b3c415c0ae512e70139aff685</id>
<content type='text'>
Signed-off-by: Ben Pfaff &lt;blp@nicira.com&gt;
Acked-by: Justin Pettit &lt;jpettit@nicira.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Ben Pfaff &lt;blp@nicira.com&gt;
Acked-by: Justin Pettit &lt;jpettit@nicira.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>nroff: Support inline XML inside &lt;pre&gt; blocks.</title>
<updated>2015-09-29T23:56:32+00:00</updated>
<author>
<name>Ben Pfaff</name>
<email>blp@nicira.com</email>
</author>
<published>2015-09-29T23:53:44+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openvswitch.git/commit/?id=41f17e52e079d9159fba9c78e9ef34f3f96a75b6'/>
<id>41f17e52e079d9159fba9c78e9ef34f3f96a75b6</id>
<content type='text'>
This is useful so that one can write, e.g.

&lt;p&gt;The following shows how to add 1 to variable &lt;var&gt;x&lt;/var&gt;:&lt;/p&gt;
&lt;pre&gt;
&lt;var&gt;x&lt;/var&gt; = &lt;var&gt;x&lt;/var&gt; + 1;
&lt;/pre&gt;

Signed-off-by: Ben Pfaff &lt;blp@nicira.com&gt;
Acked-by: Justin Pettit &lt;jpettit@nicira.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is useful so that one can write, e.g.

&lt;p&gt;The following shows how to add 1 to variable &lt;var&gt;x&lt;/var&gt;:&lt;/p&gt;
&lt;pre&gt;
&lt;var&gt;x&lt;/var&gt; = &lt;var&gt;x&lt;/var&gt; + 1;
&lt;/pre&gt;

Signed-off-by: Ben Pfaff &lt;blp@nicira.com&gt;
Acked-by: Justin Pettit &lt;jpettit@nicira.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>nroff: Allow comments in more contexts.</title>
<updated>2015-08-26T15:54:09+00:00</updated>
<author>
<name>Ben Pfaff</name>
<email>blp@nicira.com</email>
</author>
<published>2015-08-26T15:11:31+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openvswitch.git/commit/?id=dcd21433577beeb334a939e5c22fd71e9da0accc'/>
<id>dcd21433577beeb334a939e5c22fd71e9da0accc</id>
<content type='text'>
Reported-by: Russell Bryant &lt;rbryant@redhat.com&gt;
Signed-off-by: Ben Pfaff &lt;blp@nicira.com&gt;
Acked-by: Russell Bryant &lt;rbryant@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reported-by: Russell Bryant &lt;rbryant@redhat.com&gt;
Signed-off-by: Ben Pfaff &lt;blp@nicira.com&gt;
Acked-by: Russell Bryant &lt;rbryant@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>nroff: Add support for 'diagram' XML element for protocol headers.</title>
<updated>2015-08-03T17:16:44+00:00</updated>
<author>
<name>Ben Pfaff</name>
<email>blp@nicira.com</email>
</author>
<published>2015-07-29T16:04:35+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openvswitch.git/commit/?id=d70bc2449cde5a63df2cd56fe737ae4d25bddb7a'/>
<id>d70bc2449cde5a63df2cd56fe737ae4d25bddb7a</id>
<content type='text'>
This will be used in documentation for an upcoming change, to document
how Geneve OVN options are encoded.

The code in this change is from a series (not yet submitted) that makes
much more extensive use of it for documenting protocol headers.

Signed-off-by: Ben Pfaff &lt;blp@nicira.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This will be used in documentation for an upcoming change, to document
how Geneve OVN options are encoded.

The code in this change is from a series (not yet submitted) that makes
much more extensive use of it for documenting protocol headers.

Signed-off-by: Ben Pfaff &lt;blp@nicira.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>xml2nroff: Allow comments in block XML.</title>
<updated>2015-07-12T22:38:48+00:00</updated>
<author>
<name>Ben Pfaff</name>
<email>blp@nicira.com</email>
</author>
<published>2015-07-12T18:59:17+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openvswitch.git/commit/?id=7202883c3ab3c8c6c6067ef6d59ece8aa942c28d'/>
<id>7202883c3ab3c8c6c6067ef6d59ece8aa942c28d</id>
<content type='text'>
Signed-off-by: Ben Pfaff &lt;blp@nicira.com&gt;
Acked-by: Justin Pettit &lt;jpettit@nicira.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Ben Pfaff &lt;blp@nicira.com&gt;
Acked-by: Justin Pettit &lt;jpettit@nicira.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>nroff: Fix style of names.</title>
<updated>2015-07-07T04:05:51+00:00</updated>
<author>
<name>Ben Pfaff</name>
<email>blp@nicira.com</email>
</author>
<published>2015-07-07T04:05:03+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openvswitch.git/commit/?id=4d9d1d9e7248820fd192dfbc6780fc5f673594fc'/>
<id>4d9d1d9e7248820fd192dfbc6780fc5f673594fc</id>
<content type='text'>
The recommended Google Python style is multi_word_names, not
multiWordNames.

There are lots of other places where the style could be improved.
I started here because I was working in this code anyway and because
this code is only used at build time and not installed, so that it
can't break any third-party code.

Signed-off-by: Ben Pfaff &lt;blp@nicira.com&gt;
Acked-by: Justin Pettit &lt;jpettit@nicira.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The recommended Google Python style is multi_word_names, not
multiWordNames.

There are lots of other places where the style could be improved.
I started here because I was working in this code anyway and because
this code is only used at build time and not installed, so that it
can't break any third-party code.

Signed-off-by: Ben Pfaff &lt;blp@nicira.com&gt;
Acked-by: Justin Pettit &lt;jpettit@nicira.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
