summaryrefslogtreecommitdiff
path: root/tests/ovsdb-idl.at
Commit message (Collapse)AuthorAgeFilesLines
* python: make python idl unicode-tolerantLance Richardson2017-08-091-0/+13
| | | | | | | | | | | | Ensure that JSON is utf-8 encoded and that bytes sent/received on the stream sockets are in utf-8 form. Add a test case to verify that unicode data can be sent/received successfully using Python IDL module. Co-authored-by: Terry Wilson <twilson@redhat.com> Signed-off-by: Terry Wilson <twilson@redhat.com> Signed-off-by: Lance Richardson <lrichard@redhat.com> Signed-off-by: Russell Bryant <russell@ovn.org>
* ovsdb-idl: Autogenerated functions for compound indexesLance Richardson2017-08-031-0/+282
| | | | | | | | | | | | | | Generates and fills in the default comparators for columns with type int, real, string. Also creates the macros that allow iteration over the contents of the index, and perform queries. Signed-off-by: Arnoldo Lutz Guevara <arnoldo.lutz.guevara@hpe.com> Signed-off-by: Esteban Rodriguez Betancourt <estebarb@hpe.com> Co-authored-by: Arnoldo Lutz Guevara <arnoldo.lutz.guevara@hpe.com> Co-authored-by: Esteban Rodriguez Betancourt <estebarb@hpe.com> Signed-off-by: Lance Richardson <lrichard@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* python ovs: Fix SSL exceptions with pyOpenSSL v0.13Numan Siddique2017-05-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Centos provides pyOpenSSL version pyOpenSSL-0.13.1-3.el7.x86_64. There are 2 issues using this version, which this patch fixes - The test case "simple idl verify notify - SSL" is skipped. This is because "python -m OpenSSL.SSL" is used to detect the presence of pyOpenSSL package. pyOpenSSL v0.13 has C python modules because of which the above command returns 1. So this patch fixes this by using 'python -c "import OpenSSL.SSL"'. - The SSL.Context class does not have the function "set_session_cache_mode" defined. Our usage here was only relevant for server-side connections, (pssl), which is not yet supported by python-ovs, so just remove the usage of this function. The default cache mode (server) will just be ignored. I have not tested with older versions (< 0.13) of pyOpenSSL. Signed-off-by: Numan Siddique <nusiddiq@redhat.com> Acked-by: Lance Richardson <lrichard@redhat.com> Tested-by: Marcin Mirecki <mmirecki@redhat.com> Signed-off-by: Russell Bryant <rbryant@redhat.com>
* tests: Only run python SSL test if SSL support is configuredSimon Horman2017-05-041-0/+1
| | | | | | | | | | | | | | | Only run python SSL test, which invokes ovsdb with a --remote=pssl, if SSL support is configured. Without this change the following error appears when running the test-suite when OVS is configured with --disable-ssl. +ovsdb-server: Private key specified but Open vSwitch was built without SSL support ./ovsdb-idl.at:1215: exit code was 1, expected 0 Fixes: d90ed7d65ba8 ("python: Add SSL support to the python ovs client library") Signed-off-by: Simon Horman <simon.horman@netronome.com> Acked-by: Ben Pfaff <blp@ovn.org>
* ovsdb-idl: Change interface to conditional monitoring.Ben Pfaff2016-12-191-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | Most users of OVSDB react to whatever is currently in their view of the database, as opposed to keeping track of changes and reacting to those changes individually. The interface to conditional monitoring was different, in that it expected the client to say what to add or remove from monitoring instead of what to monitor. This seemed reasonable at the time, but in practice it turns out that the usual approach actually works better, because the condition is generally a function of the data visible in the database. This commit changes the approach. This commit also changes the meaning of an empty condition for a table. Previously, an empty condition meant to replicate every row. Now, an empty condition means to replicate no rows. This is more convenient for code that gradually constructs conditions, because it does not need special cases for replicating nothing. This commit also changes the internal implementation of conditions from linked lists to arrays. I just couldn't see an advantage to using linked lists. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Liran Schour <lirans@il.ibm.com>
* Python-IDL: getattr after mutate fixAmitabha Biswas2016-10-141-7/+12
| | | | | | | | | | | This commit returns the updated column value when getattr is done after a mutate operation is performed (but before the commit). Signed-off-by: Amitabha Biswas <azbiswas@gmail.com> Reported-by: Richard Theis <rtheis@us.ibm.com> Reported-at: http://openvswitch.org/pipermail/dev/2016-September/080120.html Fixes: a59912a0ee8e ("python: Add support for partial map and set updates") Signed-off-by: Russell Bryant <russell@ovn.org>
* tests: Get rid of overly specific --pidfile and --unixctl options.Ben Pfaff2016-10-121-55/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | At an early point in OVS development, OVS was built with fixed default directories for pidfiles and sockets. This meant that it was necessary to use lots of --pidfile and --unixctl options in the testsuite, to point the daemons to where they should put these files (since the testsuite cannot and generally should not touch the real system /var/run). Later on, the environment variables OVS_RUNDIR, OVS_LOGDIR, etc. were introduced to override these defaults, and even later the testsuite was changed to always set these variables correctly in every test. Thus, these days it isn't usually necessary to specify a filename on --pidfile or to specify --unixctl at all. However, many of the tests are built by cut-and-paste, so they tended to keep appearing anyhow. This commit drops most of them, making the testsuite easier to read and understand. This commit also sweeps away some other historical detritus. In particular, in early days of the testsuite there was no way to automatically kill daemons when a test failed (or otherwise ended). This meant that some tests were littered with calls to "kill `cat pidfile`" on almost every line (or m4 macros that expanded to the same thing) so that if a test failed partway through the testsuite would not hang waiting for a daemon to die that was never going to die without manual intervention. However, a long time ago we introduced the "on_exit" mechanism that obsoletes this. This commit eliminates a lot of the old litter of kill invocations, which also makes those tests easier to read. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* python: Add SSL support to the python ovs client libraryNuman Siddique2016-10-051-2/+28
| | | | | | | | | SSL support is added to the ovs/stream.py. pyOpenSSL library is used to support SSL. If this library is not present, then the SSL stream is not registered with the Stream class. Signed-off-by: Numan Siddique <nusiddiq@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovsdb: Fix mutation of newly inserted rows from Python IDL.Amitabha Biswas2016-08-301-4/+10
| | | | | | | | | | | | | | | This patch fixes the scenario, where the mutate operation on a row is sent in the same transaction as row insert operation. It was obvserved that this mutate operation was not getting committed to the OVSDB. To get around the above problem the "where" condition in an mutate operation is modified to use the named-uuid to identify a row created in the current transaction. Signed-off-by: Amitabha Biswas <abiswas@us.ibm.com> Suggested-by: Richard Theis <rtheis@us.ibm.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovsdb-idl: Fix bugs in Python IDL partial set and map.Amitabha Biswas2016-08-151-8/+12
| | | | | | | | | | | | | | | | | | This patch fixes a couple of bugs in commit a59912a0 (python: add support for partial map and partial set updates) and reverses a simplication added in commit 884d9bad (Simplify partial map Py3 IDL test) to make the Python3 test cases passes. The following changes have been made: 1. Allow multiple map updates on the same column in a transaction. 2. Partial map Py3 IDL test can now support multiple elements. 3. SetAttr overrides pre-existing insert and remove updates. 4. addvalue/delvalue contains unique elements Signed-off-by: Amitabha Biswas <abiswas@us.ibm.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Simplify partial map Py3 IDL test added by commit a59912a0Ryan Moats2016-08-141-4/+4
| | | | | | | | | | | | | | | Commit a59912a0 ("python: Add support for partial map and partial set updates") added unit tests for the partial map function for the python IDL. However, because Python3 doesn't order dictionaries consistently, this test is a crap shoot for systems that support Python3. As a short term fix, do not use a dictionary with multiple elements for the partial map test case. Change-Id: Ibdec10ebd895051321b9bff7d9fe8a7e0bd9eb88 Signed-off-by: Ryan Moats <rmoats@us.ibm.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* python: Add support for partial map and partial set updatesRyan Moats2016-08-141-0/+30
| | | | | | | | | | | | | | Allow the python IDL to use mutate operations more freely by mimicing the partial map and partial set operations now available in the C IDL. Unit tests for both of these types of operations are included. They are not carbon copies of the C tests, because testing idempotency is a bit difficult for the current python IDL test harness. Signed-off-by: Ryan Moats <rmoats@us.ibm.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovsdb: Add/use partial set updates.Ryan Moats2016-08-141-0/+36
| | | | | | | | | | | | | | | | | | | | This patchset mimics the changes introduced in f199df26 (ovsdb-idl: Add partial map updates functionality.) 010fe7ae (ovsdb-idlc.in: Autogenerate partial map updates functions.) 7251075c (tests: Add test for partial map updates.) b1048e6a (ovsdb-idl: Fix issues detected in Partial Map Update feature) but for columns that store sets of values rather than key-value pairs. These columns will now be able to use the OVSDB mutate operation to transmit deltas on the wire rather than use verify/update and transmit wait/update operations on the wire. Side effect of modifying the comments in the partial map update tests. Signed-off-by: Ryan Moats <rmoats@us.ibm.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* python tests: Skip TCP6 idl tests on WindowsPaul Boca2016-08-031-0/+1
| | | | | | | | | | The IPPROTO_IPV6 is not defined on Python for Windows because of compatibility with older Windows versions. Here is this issue discussed:https://bugs.python.org/issue6926 Signed-off-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com> Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* python: Send old values of the updated cols in notify for update2Numan Siddique2016-07-271-0/+108
| | | | | | | | | | | | | When python IDL calls the "notify" function after processing the "update2" message from ovsdb-server, it is suppose to send the old values of the updated columns as the last parameter. But the recent commit "897c8064" sends the updated values. This breaks the behaviour. This patch fixes this issue. It also updates the description of the 'updates' param of the notify function to make it more clear. Fixes: 897c8064 ("python: move Python idl to work with monitor_cond") Signed-off-by: Numan Siddique <nusiddiq@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* lib: add monitor_cond_change API to C IDL libLiran Schour2016-07-181-0/+136
| | | | | | | | | | Add to IDL API that allows the user to add and remove clauses on a table's condition iteratively. IDL maintain tables condition and send monitor_cond_change to the server upon condition change. Add tests for conditional monitoring to IDL. Signed-off-by: Liran Schour <lirans@il.ibm.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* python: move Python idl to work with monitor_condLiran Schour2016-07-181-0/+97
| | | | | | | | Python idl works now with "monitor_cond" method. Add test for backward compatibility with old "monitor" method. Signed-off-by: Liran Schour <lirans@il.ibm.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovsdb-client: support monitor-cond methodLiran Schour2016-07-181-5/+5
| | | | | | | | | | Add monitor_cond method to ovsdb-client. Enable testing of monitor_cond_change via unixctl command.Add unit tests for monitor_cond and monitor_cond_change. See ovsdb-client(1) man page for details. Replace monitor2 with monitor_cond. Signed-off-by: Liran Schour <lirans@il.ibm.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* tests: Fix issue in use of OVS_APP_EXIT_AND_WAIT.Lance Richardson2016-06-231-21/+21
| | | | | | | | | | | | | | | | | | | | | | | Commit f9b11f2a09b4 introduced a loop to wait for process exit in OVS_APP_EXIT_AND_WAIT after the "exit" command has been sent. Unfortunately, this does not work for cases where a unixctl socket has to be used to send the "exit" command because the process ID cannot be determined from the socket path. OVS_APP_EXIT_AND_WAIT_BY_TARGET has since been introduced to enable graceful termination of daemons via unixctl sockets. This set of changes addresses the problem described above by making OVS_APP_EXIT_AND_WAIT_BY_TARGET take the unixctl socket path and corresponding process ID as separate parameters. In order to better detect issues in this logic in the future, checks have been added to verify that the pidfile exists before using its contents. Tested on a Linux system. Signed-off-by: Lance Richardson <lrichard@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* tests: Use on_exit in ovsdb-idl tests.Daniele Di Proietto2016-05-231-40/+51
| | | | | | | | | | | | | Instead of hardcoding 'kill `cat pid`' on every call to AT_CHECK is simpler to use on_exit. This makes sure that we kill every started daemon and fixes a travis build timeout. Suggested-by: Ben Pfaff <blp@ovn.org> Tested-at: https://travis-ci.org/ddiproietto/ovs/builds/132404750 Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com> Acked-by: Ben Pfaff <blp@ovn.org>
* python: Add TCP passive-mode to IDL.Ofer Ben-Yacov2016-05-201-0/+29
| | | | | | | | | Requested-by: "D M, Vikas" <vikas.d-m@hpe.com> Requested-by: "Kamat, Maruti Haridas" <maruti.kamat@hpe.com> Requested-by: "Sukhdev Kapur" <sukhdev@arista.com> Requested-by: "Migliaccio, Armando" <armando.migliaccio@hpe.com> Signed-off-by: "Ofer Ben-Yacov" <ofer.benyacov@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* tests: Add test for partial map updates.Edward Aymerich2016-05-181-0/+33
| | | | | | | | | | Insert basic functionality for testing partial map updates and add a new test table named "simple2". Signed-off-by: Edward Aymerich <edward.aymerich@hpe.com> Signed-off-by: Arnoldo Lutz <arnoldo.lutz.guevara@hpe.com> Co-authored-by: Arnoldo Lutz <arnoldo.lutz.guevara@hpe.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovsdb-idl.at: Run tests with both Python 2 and 3.Russell Bryant2016-02-221-16/+40
| | | | | | | Update Python tests to run for both Python 2 and Python 3. Signed-off-by: Russell Bryant <russell@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ovsdb-idl: Add support for column tracking in IDL.Shad Ansari2016-01-121-0/+11
| | | | | | | | | | Recent IDL change tracking patches allow quick traversal of changed rows. This patch adds additional support to track changed columns. It allows an IDL client to efficiently check if a specific column of a row was updated by IDL. Signed-off-by: Shad Ansari <shad.ansar@hpe.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* lib: add monitor2 support in ovsdb-idl.Andy Zhou2015-12-111-5/+5
| | | | | | | | | | Add support for monitor2. When idl starts to run, monitor2 will be attempted first. In case the server is an older version that does not recognize monitor2. IDL will then fall back to use "monitor" method. Signed-off-by: Andy Zhou <azhou@nicira.com> Acked-by: Ben Pfaff <blp@ovn.org>
* tests: Make parse_listening_port entirely reliable.Ben Pfaff2015-11-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | In test runs, I've occasionally seen mysterious failures in which parse_listening_port failed to find the listening port even though an examination of the log file showed that it was there. I spent some time trying to figure out what was going wrong. It seemed like everything was lined up properly to ensure that a command like "ovs-vsctl set-controller br0 tcp:127.0.0.1:0" would only return to the command prompt after the new listener was ready and the proper log message was written. It was obviously a very small race because I could only reproduce it with a large test parallelism (e.g. -j10 on my quad-core laptop). The problem turned out to be asynchronous logging in ovs-vswitchd. If I turned that off, by commenting out the call to vlog_enable_async() in bridge.c, parse_listening_port became reliable. This commit works around the problem by making parse_listening_port retry for a while if necessary. It also transforms the shell function into an m4 macro (so that it can use OVS_WAIT_UNTIL) and renames it to all-uppercase to follow the convention for macros. Signed-off-by: Ben Pfaff <blp@ovn.org> Reviewed-by: Simon Horman <simon.horman@netronome.com> Acked-by: Flavio Leitner <fbl@sysclose.org>
* ovsdb-idl: Add support for change tracking.Shad Ansari2015-11-231-0/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ovsdb-idl notifies a client that something changed; it does not track which table, row changed in what way (insert, modify or delete). As a result, a client has to scan or reconfigure the entire idl after ovsdb_idl_run(). This is presumably fine for typical ovs schemas where tables are relatively small. In use-cases where ovsdb is used with schemas that can have very large tables, the current ovsdb-idl notification mechanism does not appear to scale - clients need to do a lot of processing to determine the exact change delta. This change adds support for: - Table and row based change sequence numbers to record the most recent IDL change sequence numbers associated with insert, modify or delete update on that table or row. - Change tracking of specific columns. This ensures that changed rows (inserted, modified, deleted) that have tracked columns, are tracked by IDL. The client can directly access the changed rows with get_first, get_next operations without the need to scan the entire table. The tracking functionality is not enabled by default and needs to be turned on per-column by the client after ovsdb_idl_create() and before ovsdb_idl_run(). /* Example Usage */ idl = ovsdb_idl_create(...); /* Track specific columns */ ovsdb_idl_track_add_column(idl, column); /* Or, track all columns */ ovsdb_idl_track_add_all(idl); for (;;) { ovsdb_idl_run(idl); seqno = ovsdb_idl_get_seqno(idl); /* Process only the changed rows in Table FOO */ FOO_FOR_EACH_TRACKED(row, idl) { /* Determine the type of change from the row seqnos */ if (foo_row_get_seqno(row, OVSDB_IDL_CHANGE_DELETE) >= seqno)) { printf("row deleted\n"); } else if (foo_row_get_seqno(row, OVSDB_IDL_CHANGE_MODIFY) >= seqno)) printf("row modified\n"); } else if (foo_row_get_seqno(row, OVSDB_IDL_CHANGE_INSERT) >= seqno)) printf("row inserted\n"); } } /* All changes processed - clear the change track */ ovsdb_idl_track_clear(idl); } Signed-off-by: Shad Ansari <shad.ansari@hp.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovsdb-idl: Support for readonly columns that are fetched on-demandShad Ansari2015-11-231-0/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <shad.ansari@hp.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovsdb-idl: Test script for Python register_columns functionShad Ansari2015-10-131-0/+17
| | | | | | | | | | | | | | | | | | | | Add test scripts to exercise the register_columns() function of the Python IDL. Add ability to specify columns in the "idl" command of test-ovsdb.py. All columns of all tables are monitored by default. The new "?" option can be used to monitor specific Table:Column(s). The table and their columns are listed as a string of the form starting with "?": ?<table-name>:<column-name>,<column-name>,... e.g.: ?simple:b - Monitor column "b" in table "simple" Entries for multiple tables are seperated by "?": ?<table-name>:<column-name>,...?<table-name>:<column-name>,... e.g.: ?simple:b?link1:i,k - Monitor column "b" in table "simple", and column "i", "k" in table "link1" Signed-off-by: Shad Ansari <shad.ansari@hp.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* tests: Automatically initialize OVS_*DIR vars when tests begin.Ben Pfaff2015-09-091-8/+0
| | | | | | | | | | A lot of tests need to initialize the OVS_RUNDIR, OVS_LOGDIR, etc. variables to point to the directory in which the tests run. Until now, each of them has had to do this individually, which is redundant. This commit starts to do this automatically. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Andy Zhou <azhou@nicira.com>
* tests: Skip IPv6 tests if the system does not support IPv6.Ben Pfaff2015-07-131-0/+1
| | | | | | | | | | | This is only for the tests that actually create IPv6 sockets. The tests that merely use IPv6 addresses in flow entries, etc., do not depend on kernel support. Reported-by: 俊 赵 <zhaojun12@outlook.com> Reported-at: http://openvswitch.org/pipermail/discuss/2015-July/018173.html Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Andy Zhou <azhou@nicira.com>
* Allow subclasses of Idl to define a notification hookTerry Wilson2015-04-271-0/+17
| | | | | | | | | | | | | | | It is useful to make the notification events that Idl processes accessible to users of the library. This will make it possible to keep external systems in sync, but does not impose any particular notification pattern. The Row.from_json() call is added to be able to convert the 'old' JSON response on an update to a Row object to make it easy for users of notify() to see what changed, though this usage of Row is quite different than Idl's typical use. Signed-off-by: Terry Wilson <twilson@redhat.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* ovsdb-idl: Tolerate missing tables and columns.Ben Pfaff2015-03-311-0/+75
| | | | | | | | | | | | | | | | | | | | | Until now, if ovs-vsctl (or another client of the C ovsdb-idl library) was compiled against a schema that had a column or table that was not in the database actually being used (e.g. during an upgrade), and the column or table was selected for monitoring, then ovsdb-idl would fail to get any data at all because ovsdb-server would report an error due to a request about a column or a table it didn't know about. This commit fixes the problem by making ovsdb-idl retrieve the database schema from the database server and omit any tables or columns that don't exist from its monitoring request. This works OK for the kinds of upgrades that OVSDB otherwise supports gracefully because it will simply make the missing columns or tables appear empty, which clients of the ovsdb-idl library already have to tolerate. VMware-BZ: #1413562 Reported-by: Alex Wang <alexw@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Alex Wang <alexw@nicira.com>
* socket-util: Log the kernel assigned port number when asked.Gurucharan Shetty2014-05-281-2/+2
| | | | | | | | | | | | | | | So far, we log the kernel assigned port number when the port number is not specified. On Windows, this happens multiple times because "unix" sockets are implemented internally via TCP ports. This means that many tests, specially the ovs-ofctl monitor tests, need to filter out the additional messages. Doing that is not a big deal, but I think it will keep manifesting in future tests added by Linux developers. With this commit, we simply don't print the kernel assigned TCP ports on Windows when done for "unix" sockets. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* tests: Change to parse dynamically allocated ports on windows.Gurucharan Shetty2014-05-151-2/+2
| | | | | | | | | | | In Windows, we use kernel assigned TCP port for ssl/tcp and unixctl. In tests, we parse the log files of ovsdb-server.log, test-sflow.log and test-netflow.log to get this port. In all the above cases, tcp port is allocated first and then the unixctl port. So a 'head -1' on the result should be safe. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* tests: Don't rely on strace for IPv6 IDL testcases.Joe Stringer2014-02-081-1/+1
| | | | | | | | This would cause testsuite failures if someone runs the testsuite without strace installed. Signed-off-by: Joe Stringer <joestringer@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* Add IPv6 support for OpenFlow, OVSDB, NetFlow, and sFlow.Arun Sharma2014-02-061-1/+24
| | | | | | | | | | 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>
* invoke perl as ${PERL}YAMAMOTO Takashi2013-04-221-3/+3
| | | | | | | as suggested by Ben Pfaff. Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp> Signed-off-by: Ben Pfaff <blp@nicira.com>
* tests: Avoid race conditions, by letting the kernel choose ports to bind.Ben Pfaff2013-04-181-3/+4
| | | | | | | | | | | | | | | | | | An occasionally occurring problem with "make check", especially when parallel tests are enabled, is that multiple tests try to bind the same TCP port and, of course, fail. This happens because the code to select a TCP port to bind just generates random numbers until it finds a port that is not currently in use and uses the first one, which is of course prone to races. This commit changes the tests to let the kernel directly choose an available port, which should avoid this type of failure. Also, some of the tests that generated a random free TCP port actually used the port number to bind a UDP socket, which of course doesn't work well. This commit fixes that problem too as a side effect. 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/stream: teach stream.py tcp socketIsaku Yamahata2012-10-151-1/+21
| | | | | 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/+9
| | | | | | | | | | | | | | | | 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>
* python/ovs/db/idl.py: Transaction._substitute doesn't handle list/tupleIsaku Yamahata2012-09-121-0/+10
| | | | | | | | | | | | | | | | | | | | | | 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>
* tests: Invoke daemons with --no-chdir so core files appear in test dir.Ben Pfaff2012-08-161-2/+2
| | | | | | | | | | | | | | | | | The OVS daemons "cd" to / as a normal part of their startup, since this is traditional for daemons under Unix. But this also means that, if the daemons happen to terminate with a core in the unit tests, then the core file won't be written because / has too-restrictive permissions. (Unless you run the unit tests as root, or you've got cores configured to go to a non-standard location.) This commit fixes the problem by invoking most daemons with --no-chdir so that the core files go to a test-specific directory. I didn't change invocations of the Python daemons, since Python doesn't normally terminate with a core. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Kyle Mestery <kmestery@cisco.com>
* ovsdb-idl: Improve ovsdb_idl_txn_increment() interface.Ben Pfaff2012-04-121-2/+2
| | | | | | The previous interface was just bizarre. Signed-off-by: Ben Pfaff <blp@nicira.com>
* Use `pwd` in place of $PWD, treewide.Ben Pfaff2012-03-131-2/+2
| | | | | | | | | | | | | | | | | The Autoconf manual says: Posix 1003.1-2001 requires that `cd' and `pwd' must update the `PWD' environment variable to point to the logical name of the current directory, but traditional shells do not support this. This can cause confusion if one shell instance maintains `PWD' but a subsidiary and different shell does not know about `PWD' and executes `cd'; in this case `PWD' points to the wrong directory. Use ``pwd`' rather than `$PWD'. so this commit replaces all uses of $PWD by `pwd`. Reported-by: Justin Pettit <jpettit@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* ovsdb-idl: Prevent occasional hang when multiple database clients race.Ben Pfaff2011-10-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When a client of the IDL tries to commit a read-modify-write transaction but the database has changed in the meantime, the IDL tells its client to wait for the IDL to change and then try the transaction again by returning TXN_TRY_AGAIN. The "wait for the IDL to change" part is important because there's no point in retrying the transaction before the IDL has received the database updates (the transaction would fail in the same way all over again). However, the logic was incomplete: the database update can be received *before* the reply to the transaction RPC (I think that in the current ovsdb-server implementation this will always happen, in fact). When this happens, the right thing to do is to retry the transaction immediately; if we wait, then we're waiting for an additional change to the database that may never come, causing an indefinite hang. This commit therefore breaks the "try again" IDL commit status code into two, one that means "try again immediately" and another that means "wait for a change then try again". When an update is processed after a transaction is committed but before the reply is received, the "try again now" tells the IDL client not to wait for another database change before retrying its transaction. Bug #5980. Reported-by: Ram Jothikumar <rjothikumar@nicira.com> Reproduced-by: Alex Yip <alex@nicira.com>
* python: Implement write support in Python IDL for OVSDB.Ben Pfaff2011-09-231-9/+30
| | | | | | | | | | | | | | | 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.
* ovsdb-idl: Plug hole in state machine.Ben Pfaff2011-06-211-0/+28
| | | | | | | | | | | | The state machine didn't have a proper state for "not yet committed or aborted", which meant that destroying an ovsdb_idl_txn without committing or aborting it caused a segfault. This fixes the problem by adding a new state TXN_UNCOMMITTED to the state machine. This is related to commit 79554078d "ovsdb-idl: Fix bad logic in ovsdb_idl_txn_commit() state transitions", which fixed a related bug. Bug #2438.
* Avoid sparse error or warning for sizeof(_Bool).Ben Pfaff2011-05-231-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | The sparse checker does not like taking sizeof(_Bool). Older versions of sparse output a hard error ("error: cannot size expression"). Newer versions output a warning ("warning: expression using sizeof bool"). This commit avoids the problem by not using sizeof(_Bool) anywhere. The only place where OVS uses sizeof(_Bool) anyway is in code generated by the OVSDB IDL. It generates it for populating "optional bool" columns in the database, that is, columns that are allowed to contain 0 or 1 instances of a bool. For these columns, it generates code that looks roughly like this: row->column = xmalloc(sizeof *row->column); *row->column = value; This commit changes these columns from type "bool *" to type "const bool *" and changes the generated code to: static const bool true_value = true; static const bool false_value = false; row->column = value ? &true_value : &false_value; which avoids the problem and saves a malloc() call at the same time. The idltest code had a column with a slightly different type ("0, 1, or 2 bools") that didn't fit the revised pattern and is a fairly stupid type anyhow, so I just changed it to "0 or 1 bools".