summaryrefslogtreecommitdiff
path: root/tests/test-ovsdb.py
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2016-12-19 20:55:35 -0800
committerBen Pfaff <blp@ovn.org>2016-12-19 21:02:11 -0800
commit0164e367f5d8e815bd224b1040b10c5d1a69b4dc (patch)
treedbbcf8c9411d47934f264a6d57936e7ef697436c /tests/test-ovsdb.py
parent3a60b7cd5f38badfdd15fe4ba57b5c74c9ee9fce (diff)
downloadopenvswitch-0164e367f5d8e815bd224b1040b10c5d1a69b4dc.tar.gz
ovsdb-idl: Change interface to conditional monitoring.
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>
Diffstat (limited to 'tests/test-ovsdb.py')
-rw-r--r--tests/test-ovsdb.py16
1 files changed, 4 insertions, 12 deletions
diff --git a/tests/test-ovsdb.py b/tests/test-ovsdb.py
index 185215ae6..dced56b99 100644
--- a/tests/test-ovsdb.py
+++ b/tests/test-ovsdb.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2009, 2010, 2011, 2012 Nicira, Inc.
+# Copyright (c) 2009, 2010, 2011, 2012, 2016 Nicira, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -531,25 +531,17 @@ def idl_set(idl, commands, step):
def update_condition(idl, commands):
- commands = commands.split(";")
+ commands = commands[len("condition "):].split(";")
for command in commands:
- command = command[len("condition "):]
- if "add" in command:
- add_cmd = True
- command = command[len("add "):]
- else:
- add_cmd = False
- command = command[len("remove "):]
-
command = command.split(" ")
if(len(command) != 2):
- sys.stderr.write("Error parsong condition %s\n" % command)
+ sys.stderr.write("Error parsing condition %s\n" % command)
sys.exit(1)
table = command[0]
cond = ovs.json.from_string(command[1])
- idl.cond_change(table, add_cmd, cond)
+ idl.cond_change(table, cond)
def do_idl(schema_file, remote, *commands):