369 Commits

Author SHA1 Message Date
Luis Tomas Bolivar
72038743d9 Avoid race condition when adding ovs-flows
There is a chance that patch ports are not yet created when
the agent tries to add the ovs-flows for them. This ends up in
the flows not being added until the next re-sync action or a
new VM created in the same node

Closes-Bug: #2018565
Change-Id: I598267f701587696feb31f9dedef8c9f1895fc72
2023-05-05 14:52:10 +02:00
Luis Tomas Bolivar
a1ff266565 Ensure options are registered for unit testing
As part of commit [1] we moved the register options to a function,
that means unit tests need to be updated to register those option
in the setup if they are needed, otherwise we can get errors like:

Captured traceback:
~~~~~~~~~~~~~~~~~~~
Traceback (most recent call last):
  File "/builddir/build/BUILD/ovn-bgp-agent-0.3.1.dev112/ovn_bgp_agent/tests/unit/drivers/openstack/watchers/test_bgp_watcher.py", line 878, in test_run_no_subnets_datapath
    CONF.set_override('expose_tenant_networks', False)
  File "/usr/lib/python3.9/site-packages/oslo_config/cfg.py", line 2059, in __inner
    result = f(self, *args, **kwargs)
  File "/usr/lib/python3.9/site-packages/oslo_config/cfg.py", line 2442, in set_override
    opt_info = self._get_opt_info(name, group)
  File "/usr/lib/python3.9/site-packages/oslo_config/cfg.py", line 2858, in _get_opt_info
    raise NoSuchOptError(opt_name, group)
oslo_config.cfg.NoSuchOptError: no such option expose_tenant_networks in group [DEFAULT]

[1] 90b6940b21

Change-Id: I138ab9a4ed6f7b1d0138129c00362f603fc4320a
2023-05-04 09:49:30 +02:00
Zuul
2d29afc58f Merge "Fix IndexError when no VLAN tag is defined" 2023-05-03 09:26:56 +00:00
Justin Lamp
b9652edcab
Fix IndexError when no VLAN tag is defined
When no VLAN tag is defined in the portbinding or Logical Switch Port entry, the append will fail

Change-Id: I8889ea036a8bb4ea7096d1165b0621442acea33d
Signed-off-by: Justin Lamp <justin.lamp@netways.de>
2023-05-03 10:54:08 +02:00
Zuul
05ea348425 Merge "Add ls_get_localnet_port function" 2023-05-03 08:45:37 +00:00
Luis Tomas Bolivar
264107436d Add ls_get_localnet_port function
Until ovsdbapp version can be bumped to the release 2.3.0, we need
this workaround to be able to use this function that was implemented
in [1], and that is needed for the NB DB driver

[1] https://review.opendev.org/c/openstack/ovsdbapp/+/873853

Change-Id: Id7c75d81175c283a9814b536eec473978b8b0c7f
2023-04-28 14:28:44 +02:00
Zuul
73430cd15f Merge "Revert "Bump ovsdbapp dependency"" 2023-04-28 11:11:09 +00:00
Luis Tomas Bolivar
1f87eda8a3 Revert "Bump ovsdbapp dependency"
This reverts commit 9dcede6d92464e10c2a313d5df8fb7c577e2a326.

Reason for revert: This does not meet the current uppper-constraints

Change-Id: I565a2774bd9814584c6d2cb77e7cb946718de8ac
2023-04-28 10:55:03 +00:00
Zuul
cb3b57689b Merge "Ensure all vlan tags are processed" 2023-04-28 10:15:25 +00:00
Luis Tomas Bolivar
b46dcf8d7f Ensure all vlan tags are processed
There may be serveral neutron vlan provider networks associated
to a physical bridge. For example, having ovs bridge-mappings
set to "datacentre:br-ex", and then have several provider networks
of vlan type associated to datacentre.

This was not being properly handled on the sync actions as only
the first vlan tag was being processed. This patch ensure all the
vlan tags associated to a bridge are processed and their respective
vlan devices are created

In addition, it seems the way of estimating the coverage has changed,
as now the value is higher, this patch also bumps the minimal coverage
(setting it to 92%), so that the coverage is not reduced unnoticed

Change-Id: I39168fa633f0a69439980c5a2fd163e389cf11fe
2023-04-27 19:02:29 +02:00
Luis Tomas Bolivar
9dcede6d92 Bump ovsdbapp dependency
The new NB driver depends on a new function from ovsdbapp that
is only available since 2.3.0 release.

Depends-On: https://review.opendev.org/c/openstack/releases/+/881135
Change-Id: I5439658446ff354ca213326c50ff2e108b5c9488
2023-04-27 09:33:54 +02:00
Zuul
9c7f8fc9f5 Merge "Add frr_sync function to other drivers" 2023-04-26 13:22:57 +00:00
Zuul
90b6940b21 Merge "Ensure the reconcile intervals configuration option is enforced" 2023-04-26 09:55:40 +00:00
Zuul
16823f7b8d Merge "Ensure ovn-lbs on the provider withdrawn works with cascade deletion" 2023-04-26 09:55:39 +00:00
Zuul
43f32bda9e Merge "Ensure the needed mac tweak flows are created as part of the wiring" 2023-04-26 08:55:34 +00:00
Zuul
faad4af876 Merge "Split creation of base ovs flows from removal of extra leftovers" 2023-04-26 08:39:41 +00:00
Luis Tomas Bolivar
3b85a9a31b Add frr_sync function to other drivers
Added the FRR config function to OVNEVPNDriver and
OVNBGPStretchedL2Driver

Closes-Bug: #2017682

Change-Id: I0f604523254e7fb9d6f92be508a612ed05a7f486
2023-04-26 08:50:22 +02:00
Zuul
a78a0ca724 Merge "Replace storyboard links with launchpad ones" 2023-04-26 06:26:15 +00:00
Luis Tomas Bolivar
a091cb784e Ensure the reconcile intervals configuration option is enforced
The interval to do the resync was meant to be configurable but
it was always taking the default values due to the config
being loaded after the decorator gets applied.

This patch is moving away from periodic_task in favor of
loopingcall.FixedIntervalLoopingCall so that we can more easily
enforce the reconcile intervals based on the config

Change-Id: I8c6b1ebac77336d5cbe2e725b38c5a0f53446934
2023-04-25 11:48:58 +02:00
Luis Tomas Bolivar
e045124a0b Set more reasonable default syncronization period
Change-Id: I45a384b201aee556a66d5c541fecb02bbc28b1a4
2023-04-21 11:37:34 +02:00
Luis Tomas Bolivar
55d6fb8814 Ensure ovn-lbs on the provider withdrawn works with cascade deletion
There is a race condition when using cascade deletion where the
port is already deleted when the even for the loadbalancer gets
processed, therefore not being able to retrieve the needed information
to do the withdrawn.

This patch adds new logic on the removal so that it does not rely
on the VIP port but the VIP IP information

Change-Id: I168aeba377fb15abb284973e5500f6b4c82c7947
2023-04-21 11:21:15 +02:00
Luis Tomas Bolivar
1a8066555c Ensure the needed mac tweak flows are created as part of the wiring
The patch port between br-int and the ovs provider bridge are created
upon the first VM created in that node with IP in the related provider
network (VM on the provider or FIP associated to it). Thus we need
to ensure the mac tweaking flows for those patch ports are added
as part of the wiring flow

Change-Id: Ieaa111506439625280f2ec64711a1447a5e94f54
2023-04-20 16:40:35 +02:00
Luis Tomas Bolivar
2f9ebf8ef8 Split creation of base ovs flows from removal of extra leftovers
Change-Id: I46dcaeb985e09b571d17080281a2681789eb406d
2023-04-20 16:38:22 +02:00
Luis Tomas Bolivar
2553998649 Ensure FIPs events are properly handled
When adding the exception for external networks that are not
provider [1] we break the logic for handling the FIPs association
events, and only the sync action was correcting it -- also hidding
the problem

With this patch we make the proper checking (on the patch port,
not on the VM port) to decide to only expose the FIPs if the
external networks is also a provider one

[1] d9c7de6465

Change-Id: Ie344ff0f477e32df270dedea02ff5b689f45836a
2023-04-20 15:36:30 +02:00
Lucas Alvares Gomes
ce8fcb7fc1 Replace storyboard links with launchpad ones
We are moving away from storyboard and will be using launchpad instead.

Depends-On: https://bugs.launchpad.net/ovn-bgp-agent/
Change-Id: I43f2da995af02c17de1995373bf65bf9f7c8e212
Signed-off-by: Lucas Alvares Gomes <lucasagomes@gmail.com>
2023-04-20 14:32:04 +01:00
Zuul
62fe558114 Merge "Add protection from pyroute crashed" 2023-04-20 09:30:17 +00:00
Luis Tomas Bolivar
65bd1402e8 Fix error in NB DB watcher that triggered wrong events
Change-Id: I00f4c6838865a75136223b98c9770796cc30f3af
2023-04-20 09:01:34 +00:00
Luis Tomas Bolivar
3d45f71476 Add protection from pyroute crashed
It may happen that if pyroute crashed with a dump interrupted,
and the exception is not properly handled, the agent will stop
processing further events

Change-Id: I2416393a3c45f2424aefd342380d7f9e07df9123
2023-04-20 09:00:41 +00:00
Zuul
16a7dccefe Merge "Add initial wiring configuration to a common function" 2023-04-20 08:39:25 +00:00
Luis Tomas Bolivar
6e59cf66ca Add initial wiring configuration to a common function
This is to make the NB driver a bit more independent of the mode
choosen to expose the IPs.

Change-Id: I02e3a0b15123f38995459f011b92d83c138576d6
2023-04-20 08:16:48 +02:00
Luis Tomas Bolivar
921d93896b Ensure cover information is recreated upon coverage failure
Change-Id: I3f5fcfc2f4f52627a0fc8ed3d3ac8bf6b55360ef
2023-04-17 15:13:30 +02:00
Luis Tomas Bolivar
db9d9aee9f Better protect from FRR restarts
It is possible that FRR gets restarted, loosing the configuration
added by the agent (for instance the vrf leaking). As the sync
action is kind of heavy to run it more frequently, this patch adds
a new periodic task that is in charge of just ensuring the FRR
configuration and not about the routes being exposed. That way
it can be executed more frequently.

Change-Id: I19c4a295eac6454d5aa465aa7b90ecf258701850
2023-04-14 14:07:35 +02:00
Luis Tomas Bolivar
ed43b17904 Ensure permanent mac entry are deleted from the right device
For vlan provider networks we add the mac entry for the cr-lrp
pointint to the vlan device, not the bridge itself [1].
This patch ensure the deletion part takes that into account too

[1] https://review.opendev.org/c/openstack/ovn-bgp-agent/+/875636

Change-Id: I8221457ee588cd36de08cc0976bf6a1ec377c331
2023-04-13 18:45:30 +02:00
Luis Tomas Bolivar
b4153f0fe0 Add init_var function to simplify code
Just a minor code reshape to initialited the vars at unified location

Change-Id: I5195786d6094b5b3baed5a4908c6b06d9b1e205e
2023-04-12 11:08:57 +00:00
Luis Tomas Bolivar
9052ccbc14 Ensure no wiring is added for OVN exposing method
This patch adds initial support for the OVN exposing method, where
there is no need to write stuff once VMs are created in a host, but
just to advertize them.

Note as only underlay exposing method is currently supported for
the bgp drivers, the bgp utils for wiring/unwiring only consider
these 2 methods.

Change-Id: Id0d18b70f097981289851fd65a02dcaba73a7467
2023-04-12 11:08:45 +00:00
Luis Tomas Bolivar
b35ed2cfb8 Move base bgp configurations to a common bgp utils
Some drivers are duplicating some base BGP configuration to later
expose IPs. This patch is moving them to the bgp utils to avoid
code duplication.

It will also allow different base BGP configuration for different
exposing modes within the same driver, once that is implemented.

Change-Id: I0061b4598ad649c7492af3464a07d95a21eebc69
2023-04-12 11:07:36 +00:00
Luis Tomas Bolivar
f587e4357c Add supportability matrix
Add initial information about the different options supported
by the different drivers

Change-Id: I9c49ae7d125cec90725943eeda01a5849070b11a
2023-04-12 10:29:36 +00:00
Zuul
042016d3d7 Merge "Add a new driver that uses NB DB instead of SB DB" 2023-04-12 09:53:57 +00:00
Zuul
3e27d15180 Merge "Change default IPv4 associated to provider bridges" 2023-04-11 12:44:15 +00:00
Zuul
4b42a15b36 Merge "Add vrf_leak call to sync" 2023-04-11 12:36:38 +00:00
Lucas Alvares Gomes
d3c3ace96e Change x/ovn-bgp-agent references to openstack/ovn-bgp-agent
With the move to be included in the Neutron governance we have to update
the references from x/ to openstack/

Signed-off-by: Lucas Alvares Gomes <lucasagomes@gmail.com>
Change-Id: I9bdd16d1feacefa0a9937bcf322ad7c242b506d4
2023-04-11 08:59:08 +00:00
Luis Tomas Bolivar
cb978dc244 Add a new driver that uses NB DB instead of SB DB
This patch creates a new driver using NB DB information instead of
SB DB. This has 2 objective:
- Alleviate the stress on big scale environment due to many
  connections to the SB DBs.
- Being more future proof as content generated in the SB DBs based
  on NB DB information is subject to change. For example we were
  already adviced that the information we are currently using for
  ovn LB events at the SB DB is probably going to change soon.

Depends-On: https://review.opendev.org/c/openstack/ovsdbapp/+/873853
Change-Id: Ib6bf077ce1e354652f5b728bd7192c762d3d071b
2023-04-10 09:28:44 +02:00
Luis Tomas Bolivar
3c664dd0d1 Change default IPv4 associated to provider bridges
The IPs to add to the provider bridges for both ARP and NDP
to work are moved to constant, and the IPv4 is changed by the
locallink range so that we avoid collisions with the tenant
networks, otherwise some of them won't have proper connectivity

Change-Id: Iff2fe1dff120139ce71f05e28dfa66cfb6006e10
2023-04-03 16:59:18 +02:00
Eduardo Olivares
bd202586f2 Add vrf_leak call to sync
If the FRR service is restarted, its configuration will not include the
bgp-vrf section that is necessary to advertise the IPs that the OVN BGP
agent exposes (unless the agent is restarted later).
With this patch, the bgp-vrf part is added to the FRR configuration when
the sync is executed periodically.

Change-Id: I54e29a6412fe09e727d8a373fccd085e8d25c941
2023-04-03 13:48:46 +02:00
Luis Tomas Bolivar
ddb740e2e4 Improve OVNLBMemberCreateDeleteEvent watching event
Minimize the number of SB calls to be made for certain events

Change-Id: I08b4b22565bc90750736849c3a7a6d3049009dd2
2023-03-16 19:07:23 +01:00
Luis Tomas Bolivar
d9c7de6465 Do not process external network that are not provider
It seems it is posible to have external networks (with cr-lrp
associated to them) that are not provider networks (e.g., vxlan
type). In this case we are opting for not exposing through BGP
their IPs as there is no physical infra handling it. This patch
makes sure those networks are not considered when processing the
events associated to them.

Change-Id: Ib436894e2337248b4e37039a1d6690fef406753b
2023-03-16 16:36:08 +01:00
Luis Tomas Bolivar
a298010044 Ensure localnet port events are processed
If a new provider network is created, we need to re-sync so that
we have the needed information to expose IPs on it or through
CR-LRPs that will be associated to it

Change-Id: I822ae25f93b0a9e017f86c3f0ac4ac0010d49211
2023-03-16 15:21:59 +01:00
Luis Tomas Bolivar
e0b6db65ba Ensure proper handling of missing bridge_device at wiring
We need information about the bridge_device when wiring/unwiring
the exposed IPs. If this is not provided, the wiring/unwiring functions
need to return False and the driver need to ensure it is considered,
with proper logging of the failure at exposing/withdrawing.

The missing bridge device may happen if the provider network
is deleted in between or if it was created and not yet present
due to missing sync action

Change-Id: I34c9840b1ac3073c5d50c1c6e5b2d488be9ceca9
2023-03-16 12:24:42 +01:00
Zuul
097334aa74 Merge "Add ChassisPrivateCreateEvent to the events" 2023-03-15 16:36:49 +00:00
Ihtisham ul Haq
44cb26aa32 Disable only connecting to SB leader
As we are only doing read operations, we can connect to any
Southbound cluster member, not necessarily only the leader.

Change-Id: I3f528dd10736c71825983d1fb1ee8c621c08a745
2023-03-15 16:07:10 +01:00