Commit Graph

289 Commits

Author SHA1 Message Date
Zuul b7ce3f9a74 Merge "Handle IPv6 addresses for LB IP port mappings" 2024-04-04 09:07:53 +00:00
Terry Wilson 8d206dd63d Handle IPv6 addresses for LB IP port mappings
The ovn-nb manpage states that for v6 addresses, the IPs need to
be enclosed in brackets for Load_Balancer.ip_port_mappings.

Closes-Bug: #2057471

Signed-off-by: Terry Wilson <twilson@redhat.com>
Change-Id: If93037f35723c56d3da635e1a7aa42c092c8e7d6
2024-04-02 16:41:46 -05:00
Frode Nordahl d5e21c17b2
Fix BFD functional test, avoid comparing status column
The status column is updated by OVN so we cannot rely on its
contents being stable.

The test already attempts to address this by using frozen rows,
but that does not fully solve the issue as objects are created at
different points in time and then compared, which may give
unpredictable results.

Filter out the `status` column from the affected tests.

Closes-Bug: #2058264
Change-Id: Ibaa54d93109434b445f54de583f534021defccbb
Signed-off-by: Frode Nordahl <fnordahl@ubuntu.com>
2024-03-21 07:29:35 +01:00
Zuul 4a23026174 Merge "nb: commands: fix passing string to LSP attach/detach mirror API" 2024-03-18 21:33:18 +00:00
Seena Fallah f86a5985e7 ovn-sb: remove chassis from Chassis_Private on ChassisDelCommand
When deleting a chassis from OVN Southbound it should be also deleted from Chassis_Private table

Signed-off-by: Seena Fallah <seenafallah@gmail.com>
Change-Id: Ibff5fb6c4a809e798b5cf0e70f0861264043c7ba
2024-03-18 14:24:39 +00:00
Dmitrii Skorykh f9ec5ac7c8 nb: commands: fix passing string to LSP attach/detach mirror API
Pass an instance of idlutils.Row mirror as a value instead of raw string/uuid
to addvalue/delvalue methods since OVS library Atom.from_python() ctor
doesn't expect string as an argument.

Closes-bug: #2055094
Change-Id: Ibc1a5aaefe68f7e02f92285900654c9f70aed69e
2024-02-27 01:16:11 +03:00
liushy 374bf64068 Support add/remove CIDR type address in Address_Set cmds
Related-Bug: #1982287
Change-Id: I6bfd486bf037da5b4d2dd61c84a50d6a7fbfb39d
2024-01-11 11:55:14 +08:00
Zuul 1cb9acc015 Merge "add Port_Binding to lookup_table" 2023-12-09 23:41:33 +00:00
Max Lamprecht a8ea64e028 add Port_Binding to lookup_table
Currently the index logical_port on Port_Binding
is missing because autocreate_indices() skips
indexes with multiple columns:
-> "indexes": [["datapath", "tunnel_key"], ["logical_port"]]

This slows down the ovn-bgp-agent at scale(31060 Port_Binding
entries) heavily. (See bug #https://bugs.launchpad.net/ovn-bgp-agent/+bug/2045892)

Full sync iteration:
Without Port_Binding index: ~6min
With Port_Binding index: ~5sec

Closes-Bug: #2045892
Change-Id: I815c695fd8a5e12a94e02a7a29da8aadc99541c4
2023-12-07 11:45:36 +01:00
Zuul 8e55b0b74c Merge "venv: unit tests don't work for 'hardware_vtep'" 2023-11-17 18:21:38 +00:00
Zuul c22fbe766b Merge "Handle events with conditions and match_fn" 2023-11-16 20:43:49 +00:00
Zuul 21d663a475 Merge "TAAS: Add commands for creating Mirrors" 2023-11-16 20:37:14 +00:00
Anton Vazhnetsov ef564d64aa nb: allow to add route even if learned route exists
Allow to install static route even if static route with same CIDR has
been learned by ovn-ic from another AZ.

See this commit for more information: 68105f68c3

Closes-bug: 2037573

Change-Id: I2a7a110551ee302dc9602ef6b01153262ea637d4
2023-11-15 20:20:40 +03:00
elajkat 02a7b2b7a8 TAAS: Add commands for creating Mirrors
Note: mirrors are available only from OVN v22.12.0

Change-Id: I8d70d24beefb2813c977e9f89aa0535c3494ee85
Related-Bug: #2015471
2023-10-31 16:13:10 +01:00
Anton Vazhnetsov dae455b6ee nb: provide 'route_table' in lr-route-{add,del,list}
Adds possibility to specify 'route_table' in methods for static
routes.

See this commit for more information:
1655a6c146

Closes-bug: 2037652

Change-Id: Ic965ae098adb6db2e5a057eee74250e3b6331b01
2023-10-04 18:16:03 +03:00
Anton Vazhnetsov 033b6e3bd2 nb: add 'nexthop' argument to 'lr_route_del'
In request https://review.opendev.org/c/openstack/ovsdbapp/+/882268, the ability to create ECMP routes was added. This PR adds the ability to delete these routes.

Closes-bug: 2037536

Change-Id: I84f234c6c5bbf4d318893166943de62fb87fff69
2023-10-04 18:06:31 +03:00
Terry Wilson 61935457bd Handle events with conditions and match_fn
The original goal of adding match_fn() the ovs_idl backend
implementation of RowEvent was to give an option to specify more
complex matching behavior than conditions/old_conditions allowed.

It was never intended that users would use both together, but it
also was not documented that that was the case. This patch allows
conditions and match_fn() to be treated as a logical AND to avoid
accidentally removing conditions when adding a match_fn()

Change-Id: Ifc18bf42e2a0ce8247bf986d14646f66d9554ca7
2023-10-03 14:14:33 -05:00
Anton Vazhnetsov dd56fd5bea venv: unit tests don't work for 'hardware_vtep'
If OVN and OVS are not installed on the system, but cloned into '.venv',
the 'OvsVtepVenvFixture' class is not instantiated correctly and all
unit tests fail.

Closes-bug: 2037568

Change-Id: Id26004b57cb02900faed5dabeee8956ff9c66b54
2023-09-27 23:56:49 +03:00
Zuul d542e5cee1 Merge "Ensure LrpAddCommand may_exits works without peers" 2023-05-30 14:23:22 +00:00
Luis Tomas Bolivar 267286976e Ensure LrpAddCommand may_exits works without peers
This patch sets the default for peers to [] instead of None, to match
what it is stored on the DB

Closes-Bug: #2019109
Change-Id: I66948039e61503480fd140ee9e0ce645a6ef4453
2023-05-24 16:49:07 +02:00
Luis Tomas Bolivar cc1ddf6a9e Add support for ecmp routes
Add ECMP support so that routes with different nexthops but
same ip_prefix can be added

Change-Id: I57e0caa4e604a1152f5015a6aabf3b52349b3a02
2023-05-16 09:07:09 +02:00
Zuul 770f77d86f Merge "Add if_exists and **kwargs columns to db_set" 2023-04-20 16:16:06 +00:00
Zuul e77599280b Merge "Add support for manipulating BFD entries" 2023-04-20 16:14:54 +00:00
Zuul 2b9895b346 Merge "Add 'no timeout' option to wait_for_change" 2023-04-19 17:19:23 +00:00
Frode Nordahl f8fe13af90
Add support for manipulating BFD entries
Related-Bug: #2002687
Signed-off-by: Frode Nordahl <frode.nordahl@canonical.com>
Change-Id: I0e49a0d60f40991e21f2b3f94cd99f43b07fd639
2023-04-19 19:14:38 +02:00
Terry Wilson 6ab3f75388 Add if_exists and **kwargs columns to db_set
The original API for db_set() out of an over-abundance of caution
use *args tuples in the format of ('column_name', value) due to the
fear that there may be OVSDB column names that were not valid
Python argument names (e.g. 'some-column'). But the OVSDB RFC
forbids column names that would be a problem.

This patch adds **columns which will be used only if there are
no values passed as *col_values. It also adds if_exists support
to db_set(), as there are situations where you don't want to throw
an error if you are updating a Row in a multi-op transaction and
it's possible that the row has been deleted on the server.

Change-Id: Ia17e545706a16f5c726ec52bae339e9362b0b614
2023-04-19 14:34:08 +00:00
Terry Wilson d1afa56c2d Add 'no timeout' option to wait_for_change
Neutron currently overrides wait_for_change because it needs a
version without a timeout. This adds the ability to set either
timeout=None or timeout <= 0 to not timeout.

Change-Id: Iff708c259a5500848eab73b05da70300ff8e4134
2023-04-18 18:23:46 -05:00
Rodolfo Alonso Hernandez ab6682e3f6 Add Interface paramteres to ``OvsdbIdl.add_port`` method.
Now it is possible to define the "Interface" parameters when creating
a "Port" register (a "Interface" register is created along with any
new "Port").

Related-Bug: #2006603
Change-Id: I6b946ef27b38e76fd70d2b529d645f5f09ac2404
2023-04-14 15:49:04 +02:00
Luis Tomas Bolivar f2c5a39edd Add new function ls_get_localnet_ports
This is used to detect if a given logical_switch has localnet
ports associated to it, and return them

Change-Id: Iabfc1bd0a1b2c6998a013d19c47cda10a3879c82
2023-04-04 13:36:11 +00:00
Rodolfo Alonso Hernandez 019f0a2acb All ``AddCommand`` child classes return the new register UUID
This patch fixes the return of two classes, ``HealthCheckAddCommand``
and ``GatewayChassisAddCommand``, that instead the new register UUID
were returning the register ifself.

NOTE:
* ``HealthCheckAddCommand`` is only used in ``LbAddHealthCheckCommand``
  (it has no IDL API method). It is tested in [1].
* ``GatewayChassisAddCommand`` is used in ``LrpAddCommand`` and
  ``LrpSetGatewayChassisCommand`` (it has no IDL API method). It is
  tested in [2] and [3].

[1]96cf8d6288/ovsdbapp/tests/functional/schema/ovn_northbound/test_impl_idl.py (L1731-L1762)
[2]96cf8d6288/ovsdbapp/tests/functional/schema/ovn_northbound/test_impl_idl.py (L1531-L1552)
[3]96cf8d6288/ovsdbapp/tests/functional/schema/ovn_northbound/test_impl_idl.py (L1505-L1516)

Closes-Bug: #2004170

Change-Id: I48df608aedce3012a2ae7aa4de636fa837bd47aa
2023-02-02 07:39:37 +00:00
Rodolfo Alonso Hernandez 7733f0c536 Define "LbAddIpPortMappingCommand" with latin chars
Closes-Bug: #2004186
Change-Id: Ic0e28b1113b6af1c66e6301e1851b620eac19824
2023-02-02 07:39:32 +00:00
Rodolfo Alonso Hernandez c8e7e9f619 Accept HA chassis group commands in HAChassisGroupAdd*
Now "HAChassisGroupAddChassisCommand" and
"HAChassisGroupDelChassisCommand" accept "HAChassisGroupAddCommand"
as input parameter.

That allows to add and remove "HA_Chassis" from the "HA_Chassis_Group"
register in the same transaction that has created the HA Chassis
Group.

Related-Bug: #1995078
Change-Id: I443796cc2fcd7eef46f968a8383d068bab6ae670
2023-02-01 09:51:07 +00:00
Takashi Natsume 5f429b7230 Use daemon property instead of setDaemon method
The setDaemon method of the threading.Thread was deprecated
in Python 3.10 (*).
Replace the setDaemon method with the daemon property.

*: https://docs.python.org/3.10/library/threading.html#threading.Thread.setDaemon

Change-Id: Id4b6df45ba4741e410692df7bd11db3f56f00f45
Signed-off-by: Takashi Natsume <takanattie@gmail.com>
2022-11-03 02:56:03 +00:00
Zuul fd6dab160d Merge "Don't force_reconnect() on unhandled Idl exception" 2022-10-25 03:11:18 +00:00
Terry Wilson cd70d1e290 Don't force_reconnect() on unhandled Idl exception
There's no reason to believe that reconnecting to ovsdb-server will
resolve an unhandled exception in python-ovs. In addition, since users
often subclass Idl and add their own notify() methods, there could be
exceptions thrown from that code.

The best we can do is log what is going on and rely on users to fix
the issue. Delaying with sleep() is usually a bad idea since if there
was some kind of ovsdb reconnection, it will delay calls to Idl.run()
which will handle that reconnection over several calls.

Change-Id: Iab2177fb9fa653292a3805689895f98e0833dc4a
2022-10-24 21:28:54 +00:00
Ilya Maximets 75d690d9b7 Fix logging exception while handling transaction exception
Transaction errors trigger logging exceptions due to the extra
comma that makes the second half of a message be treated as an
argument.

Change-Id: I83ef19f7fed673907a35f54dd123deb7996cce57
2022-10-05 17:21:25 +02:00
Terry Wilson c3bacb3ba3 Fix TRY_AGAIN handling
I believe removing wait_for_change back in the day was an error.
We can't do the exponential backoff ourselves because that will
also delay reconnecting to the the db, because idl.run() needs to
be called. Also, do_commit() doesn't ensure that idl.run() is
called if status is TRY_AGAIN. wait_for_change() will ensure that
we call idl.run() to reconnect quickly and don't try the txn again
until we have reconnected and the seqno has changed.

Revert "Don't spam retries 100s of times a second"
This reverts commit 6596164f51.

Revert "Ensure idl.run() called on TRY_AGAIN"
This reverts commit 1810faecc9.

Revert "Don't wait on TRY_AGAIN when calling commit_block()"
This reverts commit 158ae06bce.

Closes-Bug: #1988457
Change-Id: I237136262862d5117d08eb3b513a0b8658a79f05
2022-09-02 15:37:13 +00:00
Zuul 96cf8d6288 Merge "nb: add support for lb health checks API" 2022-07-29 20:14:07 +00:00
Zuul b286e34437 Merge "Provide base classes for {Get,Set}Options commands" 2022-07-29 19:17:17 +00:00
Zuul e5a849c302 Merge "nb: add methods to modify the lrp.networks" 2022-07-29 18:41:59 +00:00
Anton Vazhnetsov f3c5da5402 nb: add support for lb health checks API
This change adds functions and commands to add, delete, list, get and
update health checks of load balancers. Also added a method to get one
load balancer by name or uuid and methods to modify 'ip_port_mappings'
column in the load balancer.

Closes-Bug: 1964382
Change-Id: I3f8b63c64c7ac9c570dbd400c562fa97840429ca
2022-07-29 18:16:19 +00:00
Zuul d26be1cdcd Merge "vtep: add support for 'hardware_vtep' schema" 2022-07-20 15:08:43 +00:00
Anton Vazhnetsov e1cbe84fa0 nb: add methods to modify the lrp.networks
This change adds functions and commands to modify the 'lrp.networks'
column.

Closes-Bug: 1963700
Change-Id: I91d8be623dc51d332738728b569bbe4efd65de8d
2022-07-12 20:23:23 +03:00
Anton Vazhnetsov e9c6c6cc13 Provide base classes for {Get,Set}Options commands
Move common code for all {Get,Set}Options commands to base classes.

Trivial-Fix

Change-Id: I0273d321f41ad525afa4b00a99dc2d64577c9ee5
2022-07-12 20:05:36 +03:00
Terry Wilson 2e10d78ba3 Handle OVS 2.17 change to Idl.tables
The update_tables() method needs to be updated to handle the new
IdlTable structure. Ultimately, we should move the update_tables
functionality into python_ovs. Until then, this should work with
both old and new versions of OVS.

Closes-Bug: #1972989
Co-authored-by: Rodolfo Alonso <ralonsoh@redhat.com>
Change-Id: I173032f7cc63f79ee72ac7263188253e1cb6ff76
2022-05-11 15:55:44 +00:00
Terry Wilson be6622b552 Revert "Add an active wait in the "Backend.lookup""
This reverts commit bc004045cd.

There turned out to be some unresolvable issues with waiting for
events when lookup() is called from within a Command object in
the connection thread. Also the lookup of the notify_handler
was looking on the wrong object, so unless the notify_handler was
specifically passed (and we are not aware of any code that did),
this lookup timeout never actually was used.

Removing the feature, but leaving the arguments to avoid breaking
any code and adding a warning to update code if they are passed.

Change-Id: I42072ecb6a658814c7ff48cbc6f2a37a91d1eba8
2022-03-30 09:55:21 -05:00
Anton Vazhnetsov 06d25c2980 vtep: add support for 'hardware_vtep' schema
Added support for the "hardware_vtep" schema. The ``HwVtepApiIdlImpl`` class provides interaction with "hw_vtep.db".

Closes-Bug: 1960513

Change-Id: I37138e91f9dd3e42908ac1e7e7c123323177a8e8
2022-03-30 15:05:19 +03:00
Terry Wilson 06207b33e3 Fix broken behavior after recent OVS update
After the monitor_cond_since/update3 support patch in ovs
(46d44cf3be0), directly setting table.condition is broken. This
isn't something that was every truly supported. Ultimately, it
would be good if we could make this code less dependent on exactly
what happens in Idl.__init__()--maybe adding an update_tables()
method in python-ovs.

To avoid stomping on the state stored in ConditionState, instead
of replacing Idl.tables, this removes deletions and adds new
tables that were passed. Existing tables are left alone.

Closes-Bug: 1965819
Change-Id: Iad0d7472a7adce4a79111f94a2f33fc5b1a5c530
2022-03-22 18:55:43 +00:00
Slawek Kaplonski dc15bfd572 Log what exception caused abort of the transaction
In some cases, when ovsdb transaction is aborted, knowing what error
caused that can help to understand the root cause of the problem
so this patch adds such logging on the DEBUG level.

Change-Id: Ic67575ff26c689ec8ab1a5c619ae0b0a2846b05f
2022-01-24 10:01:20 +01:00
Zuul 1f2b393272 Merge "Update QoS register in "QoSAddCommand" if exists" 2022-01-17 15:24:39 +00:00