From cf3d7f3946343a63bbb0f358fa2f1b08206544d1 Mon Sep 17 00:00:00 2001 From: Open vSwitch CI Date: Jun 07 2024 17:50:21 +0000 Subject: Import openvswitch3.3-3.3.0-29 from Fast DataPath --- diff --git a/SOURCES/openvswitch-3.3.0.patch b/SOURCES/openvswitch-3.3.0.patch index 8fea091..49c60ff 100644 --- a/SOURCES/openvswitch-3.3.0.patch +++ b/SOURCES/openvswitch-3.3.0.patch @@ -2894,8 +2894,37 @@ index f463afcb3d..ac3d37ac40 100644 } else if (!strcmp(test, "transfer-leadership")) { failure_test = FT_TRANSFER_LEADERSHIP; } else if (!strcmp(test, "clear")) { +diff --git a/python/ovs/db/custom_index.py b/python/ovs/db/custom_index.py +index 587caf5e3e..3fa03d3c95 100644 +--- a/python/ovs/db/custom_index.py ++++ b/python/ovs/db/custom_index.py +@@ -90,14 +90,21 @@ class IndexedRows(DictBase, object): + index = self.indexes[name] = MultiColumnIndex(name) + return index + ++ def __getitem__(self, key): ++ return self.data[key][-1] ++ + def __setitem__(self, key, item): +- self.data[key] = item ++ try: ++ self.data[key].append(item) ++ except KeyError: ++ self.data[key] = [item] + for index in self.indexes.values(): + index.add(item) + + def __delitem__(self, key): +- val = self.data[key] +- del self.data[key] ++ val = self.data[key].pop() ++ if len(self.data[key]) == 0: ++ del self.data[key] + for index in self.indexes.values(): + index.remove(val) + diff --git a/python/ovs/db/idl.py b/python/ovs/db/idl.py -index a80da84e7a..c1341fc2a1 100644 +index a80da84e7a..b6d5ed6972 100644 --- a/python/ovs/db/idl.py +++ b/python/ovs/db/idl.py @@ -35,9 +35,9 @@ ROW_CREATE = "create" @@ -2977,6 +3006,52 @@ index a80da84e7a..c1341fc2a1 100644 str(self.server_monitor_uuid), monitor_requests]) self._server_monitor_request_id = msg.id +@@ -1013,7 +1013,9 @@ class Idl(object): + if not row: + raise error.Error('Modify non-existing row') + ++ del table.rows[uuid] + old_row = self.__apply_diff(table, row, row_update['modify']) ++ table.rows[uuid] = row + return Notice(ROW_UPDATE, row, Row(self, table, uuid, old_row)) + else: + raise error.Error(' unknown operation', +@@ -1044,9 +1046,10 @@ class Idl(object): + op = ROW_UPDATE + vlog.warn("cannot add existing row %s to table %s" + % (uuid, table.name)) ++ del table.rows[uuid] ++ + changed |= self.__row_update(table, row, new) +- if op == ROW_CREATE: +- table.rows[uuid] = row ++ table.rows[uuid] = row + if changed: + return Notice(ROW_CREATE, row) + else: +@@ -1058,9 +1061,11 @@ class Idl(object): + # XXX rate-limit + vlog.warn("cannot modify missing row %s in table %s" + % (uuid, table.name)) ++ else: ++ del table.rows[uuid] ++ + changed |= self.__row_update(table, row, new) +- if op == ROW_CREATE: +- table.rows[uuid] = row ++ table.rows[uuid] = row + if changed: + return Notice(op, row, Row.from_json(self, table, uuid, old)) + return False +@@ -1854,7 +1859,7 @@ class Transaction(object): + if row._data is None: + op["op"] = "insert" + if row._persist_uuid: +- op["uuid"] = row.uuid ++ op["uuid"] = str(row.uuid) + else: + op["uuid-name"] = _uuid_name_from_uuid(row.uuid) + diff --git a/python/ovs/fatal_signal.py b/python/ovs/fatal_signal.py index cb2e99e87d..16a7e78a03 100644 --- a/python/ovs/fatal_signal.py @@ -3047,6 +3122,102 @@ index cb2e99e87d..16a7e78a03 100644 class Alarm (threading.Thread): def __init__(self, timeout): +diff --git a/python/ovs/flow/odp.py b/python/ovs/flow/odp.py +index 7d9b165d46..a8f8c067a9 100644 +--- a/python/ovs/flow/odp.py ++++ b/python/ovs/flow/odp.py +@@ -365,29 +365,30 @@ class ODPFlow(Flow): + is_list=True, + ) + +- return { +- **_decoders, +- "check_pkt_len": nested_kv_decoder( +- KVDecoders( +- { +- "size": decode_int, +- "gt": nested_kv_decoder( +- KVDecoders( +- decoders=_decoders, +- default_free=decode_free_output, +- ), +- is_list=True, ++ _decoders["check_pkt_len"] = nested_kv_decoder( ++ KVDecoders( ++ { ++ "size": decode_int, ++ "gt": nested_kv_decoder( ++ KVDecoders( ++ decoders=_decoders, ++ default_free=decode_free_output, + ), +- "le": nested_kv_decoder( +- KVDecoders( +- decoders=_decoders, +- default_free=decode_free_output, +- ), +- is_list=True, ++ is_list=True, ++ ), ++ "le": nested_kv_decoder( ++ KVDecoders( ++ decoders=_decoders, ++ default_free=decode_free_output, + ), +- } +- ) +- ), ++ is_list=True, ++ ), ++ } ++ ) ++ ) ++ ++ return { ++ **_decoders, + } + + @staticmethod +diff --git a/python/ovs/tests/test_odp.py b/python/ovs/tests/test_odp.py +index f19ec386e8..d514e9be32 100644 +--- a/python/ovs/tests/test_odp.py ++++ b/python/ovs/tests/test_odp.py +@@ -541,6 +541,35 @@ def test_odp_fields(input_string, expected): + ), + ], + ), ++ ( ++ "actions:check_pkt_len(size=200,gt(check_pkt_len(size=400,gt(4),le(2))),le(check_pkt_len(size=100,gt(1),le(drop))))", # noqa: E501 ++ [ ++ KeyValue( ++ "check_pkt_len", ++ { ++ "size": 200, ++ "gt": [ ++ { ++ "check_pkt_len": { ++ "size": 400, ++ "gt": [{"output": {"port": 4}}], ++ "le": [{"output": {"port": 2}}], ++ } ++ } ++ ], ++ "le": [ ++ { ++ "check_pkt_len": { ++ "size": 100, ++ "gt": [{"output": {"port": 1}}], ++ "le": [{"drop": True}], ++ } ++ } ++ ], ++ }, ++ ) ++ ], ++ ), + ( + "actions:meter(1),hash(l4(0))", + [ diff --git a/python/test_requirements.txt b/python/test_requirements.txt index 5043c71e22..a1424506b6 100644 --- a/python/test_requirements.txt @@ -3526,10 +3697,62 @@ index 481afc08b3..9d8b4d06a4 100644 OVS_START_SHELL_HELPERS diff --git a/tests/ovsdb-idl.at b/tests/ovsdb-idl.at -index fb568dd823..a8df11ac48 100644 +index fb568dd823..c1c53cebe2 100644 --- a/tests/ovsdb-idl.at +++ b/tests/ovsdb-idl.at -@@ -1119,6 +1119,19 @@ OVSDB_CHECK_IDL_FETCH_COLUMNS([simple idl, initially populated], +@@ -167,8 +167,17 @@ m4_define([OVSDB_CHECK_IDL_REGISTER_COLUMNS_PY], + OVSDB_START_IDLTEST + m4_if([$2], [], [], + [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) +- AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket ?simple:b,ba,i,ia,r,ra,s,sa,u,ua?simple3:name,uset,uref?simple4:name?simple6:name,weak_ref?link1:i,k,ka,l2?link2:i,l1?singleton:name $3], +- [0], [stdout], [ignore]) ++ m4_define([REGISTER], m4_joinall([?], [], ++ [simple:b,ba,i,ia,r,ra,s,sa,u,ua], ++ [simple3:name,uset,uref], ++ [simple4:name], ++ [simple6:name,weak_ref], ++ [link1:i,k,ka,l2], ++ [link2:i,l1], ++ [indexed:i], ++ [singleton:name])) ++ AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema \ ++ unix:socket REGISTER $3], [0], [stdout], [ignore]) + AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]), + [0], [$4]) + OVSDB_SERVER_SHUTDOWN +@@ -747,6 +756,31 @@ OVSDB_CHECK_IDL([simple idl, conditional, multiple tables], + 009: done + ]]) + ++OVSDB_CHECK_IDL([indexed idl, modification and removal], ++ [], ++ [['["idltest", ++ {"op": "insert", ++ "table": "indexed", ++ "row": {"i": 123 }}]' \ ++ '["idltest", ++ {"op": "update", ++ "table": "indexed", ++ "where": [["i", "==", 123]], ++ "row": {"i": 456}}]' \ ++ '["idltest", ++ {"op": "delete", ++ "table": "indexed", ++ "where": [["i", "==", 456]]}]']], ++ [[000: empty ++001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]} ++002: table indexed: i=123 uuid=<0> ++003: {"error":null,"result":[{"count":1}]} ++004: table indexed: i=456 uuid=<0> ++005: {"error":null,"result":[{"count":1}]} ++006: empty ++007: done ++]]) ++ + OVSDB_CHECK_IDL([self-linking idl, consistent ops], + [], + [['["idltest", +@@ -1119,6 +1153,19 @@ OVSDB_CHECK_IDL_FETCH_COLUMNS([simple idl, initially populated], 003: done ]]) @@ -3549,7 +3772,7 @@ index fb568dd823..a8df11ac48 100644 m4_define([OVSDB_CHECK_IDL_WO_MONITOR_COND_PY], [AT_SETUP([$1 - Python3]) AT_KEYWORDS([ovsdb server idl Python monitor $4]) -@@ -1132,7 +1145,8 @@ m4_define([OVSDB_CHECK_IDL_WO_MONITOR_COND_PY], +@@ -1132,7 +1179,8 @@ m4_define([OVSDB_CHECK_IDL_WO_MONITOR_COND_PY], AT_CLEANUP]) m4_define([OVSDB_CHECK_IDL_WO_MONITOR_COND], @@ -3559,6 +3782,77 @@ index fb568dd823..a8df11ac48 100644 OVSDB_CHECK_IDL_WO_MONITOR_COND([simple idl disable monitor-cond], +@@ -1274,6 +1322,33 @@ OVSDB_CHECK_IDL_TRACK([track, simple idl, initially populated], + 003: done + ]]) + ++OVSDB_CHECK_IDL_TRACK([track, indexed idl, modification and removal], ++ [], ++ [['["idltest", ++ {"op": "insert", ++ "table": "indexed", ++ "row": {"i": 123 }}]' \ ++ '["idltest", ++ {"op": "update", ++ "table": "indexed", ++ "where": [["i", "==", 123]], ++ "row": {"i": 456}}]' \ ++ '["idltest", ++ {"op": "delete", ++ "table": "indexed", ++ "where": [["i", "==", 456]]}]']], ++ [[000: empty ++001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]} ++002: table indexed: inserted row: i=123 uuid=<0> ++002: table indexed: updated columns: i ++003: {"error":null,"result":[{"count":1}]} ++004: table indexed: i=456 uuid=<0> ++004: table indexed: updated columns: i ++005: {"error":null,"result":[{"count":1}]} ++006: empty ++007: done ++]]) ++ + dnl This test creates database with weak references and checks that orphan + dnl rows created for weak references are not available for iteration via + dnl list of tracked changes. +@@ -2022,6 +2097,36 @@ OVSDB_CHECK_IDL_NOTIFY([simple idl verify notify], + 015: done + ]]) + ++OVSDB_CHECK_IDL_NOTIFY([indexed idl, modification and removal notify], ++ [['track-notify' \ ++ '["idltest", ++ {"op": "insert", ++ "table": "indexed", ++ "row": {"i": 123 }}]' \ ++ '["idltest", ++ {"op": "update", ++ "table": "indexed", ++ "where": [["i", "==", 123]], ++ "row": {"i": 456}}]' \ ++ '["idltest", ++ {"op": "delete", ++ "table": "indexed", ++ "where": [["i", "==", 456]]}]']], ++ [[000: empty ++000: event:create, row={}, uuid=<0>, updates=None ++000: event:create, row={}, uuid=<1>, updates=None ++001: {"error":null,"result":[{"uuid":["uuid","<2>"]}]} ++002: event:create, row={i=123}, uuid=<2>, updates=None ++002: table indexed: i=123 uuid=<2> ++003: {"error":null,"result":[{"count":1}]} ++004: event:update, row={i=456}, uuid=<2>, updates={i=123} ++004: table indexed: i=456 uuid=<2> ++005: {"error":null,"result":[{"count":1}]} ++006: empty ++006: event:delete, row={i=456}, uuid=<2>, updates=None ++007: done ++]]) ++ + # Tests to verify the functionality of the one column compound index. + # It tests index for one column string and integer indexes. + # The run of test-ovsdb generates the output of the display of data using the different indexes defined in diff --git a/tests/ovsdb-server.at b/tests/ovsdb-server.at index b8ccc4c8e2..ce6d32aee1 100644 --- a/tests/ovsdb-server.at @@ -4502,6 +4796,144 @@ index 98e494abf4..3a33707167 100644 OVS_TRAFFIC_VSWITCHD_STOP AT_CLEANUP +diff --git a/tests/test-ovsdb.c b/tests/test-ovsdb.c +index c4ab899d45..41c1525f45 100644 +--- a/tests/test-ovsdb.c ++++ b/tests/test-ovsdb.c +@@ -2023,6 +2023,24 @@ print_idl_row_updated_link2(const struct idltest_link2 *l2, int step) + } + } + ++static void ++print_idl_row_updated_indexed(const struct idltest_indexed *ind, int step) ++{ ++ struct ds updates = DS_EMPTY_INITIALIZER; ++ ++ for (size_t i = 0; i < IDLTEST_INDEXED_N_COLUMNS; i++) { ++ if (idltest_indexed_is_updated(ind, i)) { ++ ds_put_format(&updates, " %s", idltest_indexed_columns[i].name); ++ } ++ } ++ if (updates.length) { ++ print_and_log("%03d: table %s: updated columns:%s", ++ step, ind->header_.table->class_->name, ++ ds_cstr(&updates)); ++ ds_destroy(&updates); ++ } ++} ++ + static void + print_idl_row_updated_simple3(const struct idltest_simple3 *s3, int step) + { +@@ -2172,6 +2190,21 @@ print_idl_row_link2(const struct idltest_link2 *l2, int step, bool terse) + print_idl_row_updated_link2(l2, step); + } + ++static void ++print_idl_row_indexed(const struct idltest_indexed *ind, int step, bool terse) ++{ ++ struct ds msg = DS_EMPTY_INITIALIZER; ++ ++ ds_put_format(&msg, "i=%"PRId64, ind->i); ++ ++ char *row_msg = format_idl_row(&ind->header_, step, ds_cstr(&msg), terse); ++ print_and_log("%s", row_msg); ++ ds_destroy(&msg); ++ free(row_msg); ++ ++ print_idl_row_updated_indexed(ind, step); ++} ++ + static void + print_idl_row_simple3(const struct idltest_simple3 *s3, int step, bool terse) + { +@@ -2252,6 +2285,7 @@ print_idl_row_singleton(const struct idltest_singleton *sng, int step, + static void + print_idl(struct ovsdb_idl *idl, int step, bool terse) + { ++ const struct idltest_indexed *ind; + const struct idltest_simple3 *s3; + const struct idltest_simple4 *s4; + const struct idltest_simple6 *s6; +@@ -2285,6 +2319,10 @@ print_idl(struct ovsdb_idl *idl, int step, bool terse) + print_idl_row_simple6(s6, step, terse); + n++; + } ++ IDLTEST_INDEXED_FOR_EACH (ind, idl) { ++ print_idl_row_indexed(ind, step, terse); ++ n++; ++ } + IDLTEST_SINGLETON_FOR_EACH (sng, idl) { + print_idl_row_singleton(sng, step, terse); + n++; +@@ -2297,6 +2335,7 @@ print_idl(struct ovsdb_idl *idl, int step, bool terse) + static void + print_idl_track(struct ovsdb_idl *idl, int step, bool terse) + { ++ const struct idltest_indexed *ind; + const struct idltest_simple3 *s3; + const struct idltest_simple4 *s4; + const struct idltest_simple6 *s6; +@@ -2329,6 +2368,10 @@ print_idl_track(struct ovsdb_idl *idl, int step, bool terse) + print_idl_row_simple6(s6, step, terse); + n++; + } ++ IDLTEST_INDEXED_FOR_EACH (ind, idl) { ++ print_idl_row_indexed(ind, step, terse); ++ n++; ++ } + + if (!n) { + print_and_log("%03d: empty", step); +diff --git a/tests/test-ovsdb.py b/tests/test-ovsdb.py +index 48f8ee2d70..67a45f044b 100644 +--- a/tests/test-ovsdb.py ++++ b/tests/test-ovsdb.py +@@ -228,6 +228,10 @@ def get_link2_table_printable_row(row): + return s + + ++def get_indexed_table_printable_row(row): ++ return "i=%s" % row.i ++ ++ + def get_singleton_table_printable_row(row): + return "name=%s" % row.name + +@@ -307,6 +311,14 @@ def print_idl(idl, step, terse=False): + terse) + n += 1 + ++ if "indexed" in idl.tables: ++ ind = idl.tables["indexed"].rows ++ for row in ind.values(): ++ print_row("indexed", row, step, ++ get_indexed_table_printable_row(row), ++ terse) ++ n += 1 ++ + if "singleton" in idl.tables: + sng = idl.tables["singleton"].rows + for row in sng.values(): +@@ -434,7 +446,7 @@ def idl_set(idl, commands, step): + sys.stderr.write('"set" command requires 2 argument\n') + sys.exit(1) + +- s = txn.insert(idl.tables["simple"], new_uuid=args[0], ++ s = txn.insert(idl.tables["simple"], new_uuid=uuid.UUID(args[0]), + persist_uuid=True) + s.i = int(args[1]) + elif name == "delete": +@@ -690,6 +702,9 @@ def do_idl(schema_file, remote, *commands): + idl = ovs.db.idl.Idl(remote, schema_helper, leader_only=False) + if "simple3" in idl.tables: + idl.index_create("simple3", "simple3_by_name") ++ if "indexed" in idl.tables: ++ idx = idl.index_create("indexed", "indexed_by_i") ++ idx.add_column("i") + + if commands: + remotes = remote.split(',') diff --git a/tests/test-util.c b/tests/test-util.c index 7d899fbbfd..5d88d38f26 100644 --- a/tests/test-util.c diff --git a/SPECS/openvswitch3.3.spec b/SPECS/openvswitch3.3.spec index 8f93022..2b92a58 100644 --- a/SPECS/openvswitch3.3.spec +++ b/SPECS/openvswitch3.3.spec @@ -57,7 +57,7 @@ Summary: Open vSwitch Group: System Environment/Daemons daemon/database/utilities URL: http://www.openvswitch.org/ Version: 3.3.0 -Release: 28%{?dist} +Release: 29%{?dist} # Nearly all of openvswitch is ASL 2.0. The bugtool is LGPLv2+, and the # lib/sflow*.[ch] files are SISSL @@ -767,6 +767,15 @@ exit 0 %endif %changelog +* Fri Jun 07 2024 Open vSwitch CI - 3.3.0-29 +- Merging upstream branch-3.3 [RH git: 9d435dd64a] + Commit list: + 81d2804fc3 python: ovs: flow: Fix nested check_pkt_len acts. + 8c15b5c0f3 python: idl: Fix index not being updated on row modification. + 80c935dba3 python: ovsdb-idl: Convert new_uuid insert() arg to UUID. + 6b6d7f05db python: ovsdb-idl: Make IndexedRows mirror hmap. + + * Fri Jun 07 2024 Open vSwitch CI - 3.3.0-28 - Merging upstream branch-3.3 [RH git: e5ee6d743e] Commit list: