summaryrefslogtreecommitdiff
path: root/python/ovs
Commit message (Collapse)AuthorAgeFilesLines
* socket-util: Fix set_dscp for IPv6YAMAMOTO Takashi2014-02-261-1/+14
| | | | | | | | | | | | | | | | | | | Try IPPROTO_IPV6/IPV6_TCLASS socket option as well as IPPROTO_IP/IP_TOS so that this can work for IPv6 sockets. IPPROTO_IP/IP_TOS socket option is, as it's SOL indicates, for IPv4. What happens when it's used for IPv6 sockets? On Linux, it seems to be forwarded to IPv4 code and affects IPv4 part of the socket. (e.g. non-V6ONLY case) But it doesn't seem to be the intention of this function. On other platforms including NetBSD, it just fails with ENOPROTOOPT. Probably this function should take the address family but passing it around lib/*stream*.c would be a bigger change. Cc: Arun Sharma <arun.sharma@calsoftinc.com> Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: Ben Pfaff <blp@nicira.com>
* Add IPv6 support for OpenFlow, OVSDB, NetFlow, and sFlow.Arun Sharma2014-02-061-9/+29
| | | | | | | | | | Does not add IPv6 support for in-band control. Co-authored-by: Ben Pfaff <blp@nicira.com> Signed-off-by: Nandan Nivgune <nandan.nivgune@calsoftinc.com> Signed-off-by: Abhijit Bhopatkar <abhijit.bhopatkar@calsoftinc.com> Signed-off-by: Arun Sharma <arun.sharma@calsoftinc.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* daemon: Cleanup some functions.Gurucharan Shetty2014-01-241-11/+0
| | | | | | | | Some functions are unused and some functions can be declared as static. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* jsonrpc: Only compose message to log if it's really going to be logged.Ben Pfaff2013-10-252-2/+26
| | | | | | | | | This suppresses a testsuite failure when the testsuite is run from a directory whose name contains a non-ASCII character. I'd rather fix the problem but webpages like the following make it sound difficult or impossible on Python 2.x: http://stackoverflow.com/a/11742928 Signed-off-by: Ben Pfaff <blp@nicira.com>
* socket-util: Add symlink based workaround for long pathnames.YAMAMOTO Takashi2013-10-171-1/+45
| | | | | | | | | The existing /proc workaround only works on Linux. Symlinks are more widely available. Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Co-authored-by: Ben Pfaff <blp@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* ovsdb-idl: Remove write-only member 'commit_seqno' from ovsdb_idl_txn.Ben Pfaff2013-10-081-1/+0
| | | | | Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
* vlog: Fix formatting of milliseconds in Python log messages.Ben Pfaff2013-09-171-2/+2
| | | | | | | | | | | Commit 2b31d8e713de7 (vlog: Report timestamps in millisecond resolution in log messages.) introduced milliseconds to log messages by default, but the Python version did not ensure that milliseconds were always formatted with 3 digits, so 3.001 was formatted as "3.1" and 3.012 as "3.12", and so on. This commit fixes the problem. CC: Paul Ingram <paul@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* vlog: Report timestamps in millisecond resolution in log messages.Paul Ingram2013-09-131-1/+2
| | | | | | | To make debugging easier. Signed-off-by: Ben Pfaff <blp@nicira.com> Signed-off-by: Paul Ingram <pingram@nicira.com>
* Fix misspellings in comments and docs.Andy Hill2013-06-042-2/+2
| | | | | | | | 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>
* python: fix a typo error in python/ovs/socket_util.py.Alex Wang2013-04-181-2/+2
| | | | | | | | | | | | | The commit 89d7ffa9 (python: Workaround UNIX socket path length limits), fixes most failed tests. But it has a typo and the typo causes the failure of test <unixctl server errors - Python> when the path length is very long (e.g. more than 90 characters). This patch fixes the above issue. Signed-off-by: Alex Wang <alexw@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* python/ovs/poller.py: workaround an eventlet bugYAMAMOTO Takashi2013-04-161-0/+13
| | | | | Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: Ben Pfaff <blp@nicira.com>
* python.ovs.db.idl: Fix Row.delete() of a row already committed to the db.Ben Pfaff2013-04-081-1/+3
| | | | | | | | | | | Row.delete() handled the case of deleting a row that was added within the current transaction, but not yet committed, but it did not correctly handle the case of deleting a row that belonged to the database before the transaction started. This fixes the problem. Reported-by: Yeming Zhao <zhaoyeming@gmail.com> Tested-by: Yeming Zhao <zhaoyeming@gmail.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* vlog: extend syslog format to make OVS logs easier to filterRomain Lenglet2013-04-051-1/+1
| | | | | | | | Prepend "ovs|" to syslog logs to make them easier to filter out of all LOG_DAEMON logs. Signed-off-by: Romain Lenglet <rlenglet@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* ovsdb-idlc: Make no-op writes to write-only columns cheaper.Ben Pfaff2013-03-051-1/+10
| | | | | | | | | For 1000 tunnels with CFM enabled, this reduces CPU use from about 36% to about 30%. Bug #15171. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* python: Do not include time stamp in syslog messages.Andy Zhou2013-02-281-2/+6
| | | | | | | | | | | | | | | vlog.py currently generates the same log messages, starts with the time stamp information, for console, syslog and file. All messages start with current time stamp information. Syslogd, by default, prepends time stamp with each message already. Thus the time stamp generated by vlog.py is redundant. This patch removes time stamp from the message before vlog.py sends it to syslogd. Signed-off-by: Andy Zhou <azhou@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* stream-unix: Use rundir as root for relative paths.Pavithra Ramesh2013-02-111-0/+4
| | | | | | | | | | | | | | Until now, "unix:" and "punix:" paths that are not absolute have been considered relative to the current working directory. It is more useful to consider them relative to the rundir, so this commit makes that change to the C and Python implementations of the stream code. This commit also relaxes the whitelist check in the bridge code so that any name that does not contain a "/" is considered OK. Signed-off-by: Pavithra Ramesh <paramesh@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* python/ovs/db/types: Fix English grammar for enums with one member.Ben Pfaff2013-02-041-1/+3
| | | | | | | | | | | | | Before this change, enums that have one member were formatted as, e.g.: "one of xyzzy, , or " This changes them to be formatted as: "must be xyzzy" which makes much more sense. (An enum with one member may make some sense if you are trying to leave the possibility for future expansion.) Signed-off-by: Ben Pfaff <blp@nicira.com>
* python: Workaround UNIX socket path length limitsJames Page2013-01-161-2/+37
| | | | | | | | | | | | | | | | | | | | | | | | | From aa28e8bfb646a54ba91e3545f3c0b9db39eddb7f Mon Sep 17 00:00:00 2001 From: James Page <james.page@ubuntu.com> Date: Wed, 16 Jan 2013 10:52:59 +0000 Subject: [PATCH] python: Workaround UNIX socket path length limits To: dev@openvswitch.org UNIX socket paths have a limit in terms of length. On Linux this is 103 characters. This is a problem in Debian/Ubuntu buildds which can generate quite long paths. This patch works around this issue by detecting when socket connection/binding fails due to this issue and accessing the socket path using a file descriptor path in /proc/self/fd. The workaround is limited to Linux. This is based on similar code in the C parts of OpenvSwitch. Signed-off-by: James Page <james.page@ubuntu.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* daemon: Start monitor process, not daemon process, in new session.Ben Pfaff2012-12-131-2/+3
| | | | | | | | | | | | | | | | | | | | | | To keep control+C and other signals in the initiating session from killing the monitor process, we need to put the monitor process into its own session. However, until this point, we've only done that for the daemon processes that the monitor started, which means that control+C would kill the monitor but not the daemons that it launched. I don't know of a benefit to putting the monitor and daemon processes in different sessions, as opposed to one new session for both of them, so this change does the latter. daemonize_post_detach() is called from one additional context where we'd want to be in a new session, the worker_start() function, but that function is documented as to be called after daemonize_start(), in which case we will (after this commit) already have called setsid(), so no additional change is required there. Bug #14280. Reported-by: Gordon Good <ggood@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* python/ovs/stream: Fix Stream.connect() retval for incomplete connection.Ben Pfaff2012-11-211-9/+11
| | | | | | | | | | If the loop condition in Stream.connect() was false, which is especially likely for TCP connections, then Stream.connect() would return None, which violates its documented behavior. This commit fixes the problem. Reported-by: Isaku Yamahata <yamahata@valinux.co.jp> Tested-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Ben Pfaff <blp@nicira.com>
* socket-util: Remove get_socket_error().Ben Pfaff2012-11-201-6/+0
| | | | | | | It has no remaining users. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* socket-util: Avoid using SO_ERROR.Ben Pfaff2012-11-201-2/+16
| | | | | | | | ESX doesn't implement it, and there's another approach that should work everywhere, so drop back to that. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* python/ovs/socket_util: Fix error path in set_nonblocking.Ben Pfaff2012-11-201-1/+1
| | | | | | | | 'e' is an exception, not a socket, so get_exception_errno() is the appropriate function to obtain an error code from it. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Kyle Mestery <kmestery@cisco.com>
* don't use select.POLL* constantsFUJITA Tomonori2012-11-193-19/+23
| | | | | | | | | | | Python doesn't have select.POLL* constants on some architectures (e.g. MacOSX). This code needs to define the constants for itself. It uses select.POLL* constants only internally (doesn't pass them outside). So there is no harm even if the definition would conflict with Python's those. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Ben Pfaff <blp@nicira.com>
* stream.py: un-decorator Stream.register_methodIsaku Yamahata2012-10-171-7/+4
| | | | | | | | | c38f8724aeb994fd840fa4283a07e38c3c114d68 made stream.py not use class decorator. So Stream.register need not to be decorator any more. So simplify it. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Ben Pfaff <blp@nicira.com>
* stream.py: Don't use class decorators.Reid Price2012-10-161-2/+2
| | | | | | | | | | | | | Commit 8cc820 (python/ovs/stream: teach stream.py tcp socket) made a change that used class decorators. Unfortunately, they were not introduced until Python 2.6. XenServer uses Python 2.4, so the change caused some Python-based daemons not to start. This commit uses an alternate syntax suggested by Reid Price. Bug #13580 Signed-off-by: Justin Pettit <jpettit@nicira.com> Signed-off-by: Reid Price <reid@nicira.com>
* python/ovs/socket_util: don't use Exception, but ValueErrorIsaku Yamahata2012-10-161-3/+3
| | | | | | | | | | 67656b9ff297f305b3bfcca2868e8e870e108283 used Exception, but it should be more specific error. Use ValueError instread of Exception. Suggested-by: Reid Price <reid@nicira.com> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Ben Pfaff <blp@nicira.com>
* python/ovs/stream: teach stream.py tcp socketIsaku Yamahata2012-10-151-10/+56
| | | | | Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Ben Pfaff <blp@nicira.com>
* python/ovs/socket_util: add tcp related helper functions which will be used ↵Isaku Yamahata2012-10-151-0/+42
| | | | | | | by tcp Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Ben Pfaff <blp@nicira.com>
* python/ovs/db/idl: getattr(Row) raises TypeError, not AttributeError.Isaku Yamahata2012-09-271-0/+3
| | | | | | | | | | | | | | | | In some cases getattr(Row instance, attrname) doesn't raise AttributeError, but TypeError > File "python/ovs/db/idl.py", line 554, in __getattr__ > datum = self._data[column_name] > TypeError: 'NoneType' object has no attribute '__getitem__' So getattr(Row instance, attrname, default value) doesn't work. This occurs when row._changes doesn't include attrname and row._data is None. So teach Row.__getattr__ _data=None case. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Ben Pfaff <blp@nicira.com>
* jsonrpc: Fix Python implementation of inactivity logic.Ben Pfaff2012-09-181-14/+14
| | | | | | | | | | | | | | When a JSON-RPC session receives bytes, or when it successfully sends queued bytes, then it should count that as activity. However, the code here was reversed, in that it used the wrong check in each place. That is, when it tried to receive data, it would check whether data had just been sent, and when it tried to send data, it would check whether data had just been received. Neither one makes sense and doesn't work. Bug #13214. Reported-by: Luca Giraudo <lgiraudo@nicira.com> CC: James Schmidt <jschmidt@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* python/ovs/db/idl.py: Transaction._substitute doesn't handle list/tupleIsaku Yamahata2012-09-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | Since Transaction._substitute doesn't substitute elements of list/tuple, setting list references results in transaction error. Teach it such case. Example: {"op": "update", "row":{"bridges":["set",[["uuid", "1f42bc19-307f-42e7-a9c0-c12178bd8b51"], ["uuid", "f97e0c76-7146-489d-9bed-29bc704f65fe"]]]}, "table": "Open_vSwitch", "where":[["_uuid", "==", ["uuid", "20c2a046-ae7e-4453-a576-11034db24985"]]]} In the above case, uuid in "row" aren't replaced by "named-uuid" because the function doesn't look into elements of lists. When list/tuple is found, look into elements recursively. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Ben Pfaff <blp@nicira.com>
* python/ovs/db/idl: make SchemaHelper accept schema in json formIsaku Yamahata2012-09-121-7/+16
| | | | | | | | This is needed when using schema that was retrieved from ovsdb by get_schema method. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Ben Pfaff <blp@nicira.com>
* python/ovs/db/idl: add counterpart of ovsdb_idl_add_table()Isaku Yamahata2012-09-121-0/+13
| | | | | | | | Add register_table method to SchemaHelper as Python counterpart of ovsdb_idl_add_table() in the C version of the IDL. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Ben Pfaff <blp@nicira.com>
* python/ovs: socket_util uses select.pollIsaku Yamahata2012-09-122-3/+4
| | | | | | | | | The changeset of ed815d9bd28422a490fe370d7804d24bcd676806 eliminated the use of select.poll for eventlet/gevent. It forgot to select.poll in socket_util. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Ben Pfaff <blp@nicira.com>
* jsonrpc: Treat receiving part of a message as activity.Ben Pfaff2012-09-071-0/+14
| | | | | | | | | | | | | | | Until now, the jsonrpc code has only counted receiving a full JSON-RPC messages as activity. This could theoretically time out, then, while a very long message is in transit or if a slow link is involved. This commit changes this code to count receiving any part of a message as activity. This isn't a problem for OpenFlow connections because OpenFlow messages are at most 64 kB in size. This problem hasn't actually been observed in practice. Bug #12789. Signed-off-by: Ben Pfaff <blp@nicira.com>
* jsonrpc: Treat draining data from send queue as activity.Ben Pfaff2012-09-071-1/+11
| | | | | | | | | | | | | | | | | | | Until now, the jsonrpc module has used messages received from the remote peer as the sole means to determine that the JSON-RPC connection is up. This could in theory interact badly with a remote peer that stops reading and processing messages from the receive queue when there is a backlog in the send queue for a given connection (ovsdb-server is an example of a program that behaves this way). This commit fixes the problem by expanding the definition of "activity" to include successfully sending JSON-RPC data that was previously queued. The above change is exactly analogous to the similar change made to the rconn library in commit 133f2dc95454 (rconn: Treat draining a message from the send queue as activity.). Bug #12789. Signed-off-by: Ben Pfaff <blp@nicira.com>
* reconnect: Rename reconnect_received() to reconnect_activity().Ben Pfaff2012-09-072-15/+16
| | | | | | | | | | | | Receiving data is not the only reasonable way to verify that a connection is up. For example, on a TCP connection, receiving an acknowledgment that the remote side has accepted data that we sent is also a reasonable means. Therefore, this commit generalizes the naming. Also, similarly for the Python implementation: Reconnect.received() becomes Reconnect.activity(). Signed-off-by: Ben Pfaff <blp@nicira.com>
* python/ovs/poller: use select.select instead of select.poll.Isaku Yamahata2012-09-051-2/+61
| | | | | | | | | | | | eventlet/gevent doesn't work well with select.poll because select.poll blocks python interpreter as a whole instead of switching from the current thread which is about to block to other runnable thread. So ovsdb python binding can't be used with eventlet/gevent. Emulate select.poll with select.select because using python means that performance isn't so important. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Ben Pfaff <blp@nicira.com>
* dirs: dbdir default must be based on sysconfdir.Ben Pfaff2012-08-032-8/+29
| | | | | | | | | | | | | | | Some in-tree and out-of-tree code sets the OVS_SYSCONFDIR environment variable to control where /etc files go (mostly for test purposes). When the database directory (dbdir) was split off from the sysconfdir, the configure-time default continued to be based on the sysconfdir, but overriding the sysconfdir at runtime with OVS_SYSCONFDIR didn't have any effect on the dbdir, which caused a visible change in behavior for code that set the OVS_SYSCONFDIR environment variable. This commit reverts that change in behavior, by basing the dbdir on OVS_SYSCONFDIR if that environment variable is set (but the OVS_DBDIR environment variable is not). Signed-off-by: Ben Pfaff <blp@nicira.com>
* Fix a typo in commit f973f2af2.Mehak Mahajan2012-08-011-1/+1
| | | | Signed-off-by: Mehak Mahajan <mmahajan@nicira.com>
* Make the location of the database separately configurable.Ben Pfaff2012-08-011-0/+1
| | | | | | | | | The default is unchanged, /etc/openvswitch/conf.db. This makes it possible to transition each Open vSwitch packaging from /etc/openvswitch/conf.db to /var/lib/openvswitch/conf.db independently. Signed-off-by: Ben Pfaff <blp@nicira.com>
* Fix "*tivty" typos.Justin Pettit2012-07-251-1/+1
| | | | Signed-off-by: Justin Pettit <jpettit@nicira.com>
* python: Call 'wait' methods correctly in jsonrpc and stream code.Ben Pfaff2012-07-022-2/+2
| | | | | | Bug #12301. Reported-by: Mike Kruze <mkruze@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* Python daemons: Changed log date time format.Arun Sharma2012-07-021-1/+1
| | | | | | | | Changed the python daemons log date and time format to keep similar as C binaries logging format. The date time is in UTC. Signed-off-by: Arun Sharma <arun.sharma@calsoftinc.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* lib: Utilize smaps in the idl.Ethan Jackson2012-06-141-0/+5
| | | | | | | | | | String to string maps are used all over the Open vSwitch database. Before this patch, they were implemented in the idl as parallel string arrays. This strategy has proven a bit cumbersome. With this patch, string to string maps are implemented using the smap library. Signed-off-by: Ethan Jackson <ethan@nicira.com>
* python: Implement "vlog/set", "vlog/list" unixctl commands in Python vlog.Ben Pfaff2012-05-221-19/+59
| | | | | | | | | | This doesn't implement control over log patterns, though. The change to vlog.man in this commit doesn't have any practical effect because OVS doesn't come with any Python daemons that have their own manpages. Signed-off-by: Ben Pfaff <blp@nicira.com>
* python: Implement "vlog/reopen" unixctl command in Python vlog.Ben Pfaff2012-05-221-3/+30
| | | | Signed-off-by: Ben Pfaff <blp@nicira.com>
* python: Break unixctl implementation into registry, client, and server.Ben Pfaff2012-05-223-75/+163
| | | | | | | | | | | I wish to add some unixctl commands to the Python vlog module. However, importing ovs.unixctl in ovs.vlog creates a circular dependency, because ovs.unixctl imports ovs.vlog already. The solution, in this commit, is to break the unixctl module into three parts: a register (ovs.unixctl) that does not depend on ovs.vlog, and client (ovs.unixctl.client) and server (ovs.unixctl.server) modules that do. This breaks the circular dependency. Signed-off-by: Ben Pfaff <blp@nicira.com>
* Global replace of Nicira Networks.Raju Subramanian2012-05-0220-20/+20
| | | | | | | | 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>