Commit Graph

148 Commits (master)

Author SHA1 Message Date
Mitchell Jameson d040e2d60c Don't update VNIC type on trunk port delete
This resolves an issue introduced by
https://review.opendev.org/c/openstack/neutron/+/892815

Change-Id: I00c8bd0a330d6d57d2a461b32a2b0dbd9d37506d
2023-11-21 19:33:54 -08:00
Mitchell Jameson cec3251ee7 Add support for provisioning L2 connectivity for L3 GW ports
Change-Id: I2a0eab2bcb087f206252b3d8e5ea095187d1a07e
2023-05-03 09:32:37 -07:00
Nader Lahouti 0fff7b8ae3 Use context manager from neutron-lib accessing VlanAllocation
Changed the code to use context manager for updating ml2_vlan_allocations db when
arista_vlan type driver is in use. This also makes the code compatible with
SQLAlchemy version 2.0 where Session.autocommit is removed

Change-Id: I75b760a27d7aef29591c0efc03542d37a30afd70
2022-12-14 21:40:44 -08:00
Zuul e04620b729 Merge "Revert "Check for missing port bindings each sync period"" 2022-10-21 00:58:28 +00:00
Mitchell Jameson 8c882aadd8 Revert "Check for missing port bindings each sync period"
This reverts commit 14640a366c.

Reason for revert: This causes issues for HA deployments as it may cause port bindings to be synced before dependent ports, vms, networks, etc.. Rather than working around the upstream issue, I think we need to try to fix it (or treat it as a known limitation that requires re-creating DVR ports as a workaround.)

Change-Id: I903133a0365ddee9b309962c26c06ac6ba0abb68
2022-10-13 20:53:38 +00:00
Mitchell Jameson 76b2378f6b Don't send sync complete on sync failure after switchover
Change-Id: Ib3792f9d3c18dd828000ca4721594c5c3885800a
2022-07-01 22:59:54 -07:00
Mitchell Jameson 03a525f9b0 Don't use router_interface fixed_ip for MLAG peer SVI IPs
When selecting IPs for MLAG peers SVIs, we typically choose
the top two IPs in the subnet (eg. .254 and .253 in a /24).
However, this may collide with the fixed_ip for the router,
which will cause EOS to reject the router create on one of
the peers as the VARP IP cannot be the same as the SVI IP.

The fix prosed here is to use the third highest IP in the
subnet if the fixed_ip is one of the two highest IPs in the
subnet.

Change-Id: I6a320a31b55edc947d288c9ad030bc476ae6ee9f
2022-05-03 17:09:15 -07:00
Mitchell Jameson 8a02945f61 Start running jobs against newer python versions
Notable changes:
 - bump hacking to make it py38+ compatible
    - (with changes to pass against the newer pep8 rules)
 - ensure requests get monkey-patched to avoid exceeding
   maximum recursion depth in SSL
 - start running openstack-python3-yoga-jobs-neutron

Change-Id: I84be86737b493dfc811a772bbeabefd10e645206
2022-03-03 22:14:20 -08:00
Mitchell Jameson 113ac088ab Add connectivity property to MechanismDrivers
A recent change (https://review.opendev.org/c/openstack/neutron/+/826502)
now requires that L2 drivers specify their connectivity in a property
rather than in vif_details. This change updates the mech drivers
in networking-arista to follow that paradigm

Change-Id: I9c5805b9dfa3b21dbe422b7ba3e2babf700aec9a
2022-03-03 17:17:28 -08:00
Mitchell Jameson 8b1273a07a Make unit tests backwards compatible with the latest pyPI Neutron
It's difficult to ensure the Neutron master is installed in the test
env, so this change allows tests to run against a slightly older
Neutron that still looks for 'tenant_id' in the trunk dict.

Change-Id: I7de8939923bd60cc31097c3469e5bb2183f41262
Closes-Bug: 1954697
2021-12-14 12:32:10 -08:00
Mitchell Jameson 2766d4eea3 Fix unit tests and lower-constraints
- Fixup constraints, requirements and tox envs
- Update trunk-related tests to account for 8bad71ad36

Change-Id: I87000a819276b98203a4a27d3ae2918f5f459553
2021-11-01 14:10:09 -07:00
Mitchell Jameson f26e45b2b3 Use new callback payloads for PORT AFTER_UPDATE and AFTER_DELETE
Change-Id: I9b03cafafbca2a0d537d05842055bc08943ce8e8
2021-07-15 12:56:40 -07:00
Mitchell Jameson 155f93d1e5 Add support for specifying switch shortnames in physnets for HPB
Change-Id: I9a9d57ecfadc194024d3619928f3a816d12cba75
2021-06-01 09:32:13 -07:00
Mitchell Jameson 1327851e5a Add test coverage for managed_physnets without HPB
Change-Id: I15ff2a95632f6066310023ce204e59946b292815
2021-05-06 13:18:49 -07:00
Mitchell Jameson 02e953f96c Fix handling of FQDN in port binding delete
When a port binding resource update comes in from the provisioning
queue, its host will always be the FQDN (if Neutron/Nova have been
configured to use FQDN hostnames.) If use_fqdn is false, we already
use the short host name on create and in tracking existing neutron
and CVX resources, but on delete, we're correctly querying the DB
with the FQDN, but then continuing to use the FQDN in forcing the
CVX update and generating the data for the HTTP DELETE call.

The proposed fix is to override the force_resource_update and
_delete_neutron_resource methods to correct the hostname in those
calls if necessary.

Change-Id: Ifaca6c22770991a6195f69dd245c865ebf978138
2021-04-29 22:25:21 -07:00
Mitchell Jameson 14640a366c Check for missing port bindings each sync period
When two DVR bindings go to ACTIVE simultaneously, one of the
updates will hit a stale data exception when commit to the DB.
This will ultimately result in update_port_postcommit not getting
called when the second binding's status goes to ACTIVE on retry.

To handle this, we now check for missing port bindings once per
sync period.

Change-Id: I8262bec98993fe80ca3482a47d283aeafea75101
2020-12-15 00:18:06 +00:00
Mitchell Jameson 32bbd0fb14 Revert "Bind DVR ports when DOWN to workaround upstream issue"
This reverts commit 7da640b4ed.

Reason for revert: Breaks sync when DVR ports are DOWN while DVR port bindings exist

Change-Id: If6d5f67da7a19d4d5e0469023e24e060afa2c2d3
2020-12-14 23:25:49 +00:00
Mitchell Jameson 7da640b4ed Bind DVR ports when DOWN to workaround upstream issue
When two DVR bindings go to ACTIVE simultaneously, one of the
updates will hit a stale data exception when commit to the DB.
This will ultimately result in update_port_postcommit not getting
called when the second binding's status goes to ACTIVE on retry.

In order to workaround this issue, we now bind DVR ports even
in a DOWN state.

Change-Id: I4811c8ce398a5a95a446c68ed81af550f6ea394f
(cherry picked from commit f2e081e7fa)
2020-12-04 21:48:30 +00:00
Mitchell Jameson 6697901bdd Fix security_group unit tests
Change-Id: I913e8299a75c3735038aaaf66d60389221520db2
2020-12-04 11:56:41 -08:00
Mitchell Jameson a778bf9056 Don't call get_session in vlan type driver
In stein the get_session function was removed from the
upstream type driver helper. This change replaces that
with calls to neutron-lib's db_api.

This also re-enables the type driver unit tests which have
been disabled for a while (missing __init__.py) and adds
coverage for a upstream test cases for the upstream VLAN
type driver against the Arista VLAN type driver.

Change-Id: I5b52abafadf236278ca707c89b69883501992219
2020-11-05 00:09:18 -08:00
Mitchell Jameson 7ac2b9585e Fix handling of ERROR ports and '' device_id
This change contains two fixes:
1. When a port goes to ERROR state, treat it as a delete
2. When a device_id is '', don't query for all instances

Change-Id: I587fef123e0552cc3bd2fe3fb74cfcb2dbb23c8b
2020-05-15 15:03:41 -07:00
Alin Iorga 5843ba4cc6 Test routes are not deleted on sync
This test adds support to store defined routes in unit tests and to
validate that no routes are recreated during sync operation

Change-Id: If2bc4b7334f472d83b307fecc6aad5b20f6b86af
2020-04-14 08:56:34 -07:00
Alin Iorga 382e8a9266 Remove delete_default_gateway from create_router
This change removes the delete_default_gateway function from
create_router call path and updates the synchronize function to update
proper VRF default gateways only when needed.

Change-Id: I874b3f15f39e914282d7b92a07af9024c39e916f
2020-04-04 09:32:44 -07:00
Alin Iorga 4b002ee6bb Use show version to validate vrf support
Updated the code to use show version to check which vrf creation command
the switch supports. This will eliminate extra entries in syslog

Change-Id: Id3c3e42d2fc7165e5ea3c20bec3343c559f6465f
2020-02-21 10:32:36 -08:00
Alin Iorga 9b721aa315 Synchronize requirements with neutron
This commit is removing support fro python2 in networking-arista and
synchrinizing the package requirements with neutron. Because of this
some code changes have been performed in order for the pep8 test to pass

Change-Id: I829d7eec72cb22d1142782894b9833769f432a66
2020-01-30 15:10:14 -08:00
Alin Iorga 06d6342a44 Add option to create default route to router VRFs
This change adds the option to create default route for routers that
have a default gateway defined. This is controled by setting
vrf_default_route option in the configution

Change-Id: I16ae7feacb04730111a4b5eb61d2c3ae0fb3f041
2020-01-06 17:23:13 +00:00
Alin Iorga 19642cd335 Update L3 plugin to handle new syntax for deprecated vrf forwarding
Change-Id: I30e77ea2f8b4fa29ce309cb075e6ed780af6d7bc
2019-12-02 23:27:03 +00:00
Alin Iorga 5db5ff746f Update L3 plugin to handle switches that support vrf instance
L3 plugin will be able to handle both swtiches that support only the
newer syntax with vrf instance and the old vrf definition syntax.

Change-Id: I2e9b88c4e6d18eb3880f44532c93cc8cb9b2f2f4
2019-11-26 18:38:58 +00:00
Alin Iorga 4077e846d8 Update create_network test wrapper to set mtu as 1450 if does not exist.
Change-Id: I3b80697173b133e0c6924c6b22b28cfae28ddc77
2019-11-08 15:24:54 -08:00
Mitchell Jameson 84a118e718 Improve performance of sync under heavy load
This change includes 3 fixes:
1. Sync workers sleep for [0,1) seconds after every sync
2. Dependent resources are always synced in the same sync cycle
3. Sync lock is released on failure if at least one successful sync has occurred

Change-Id: I1ab75dcce69b68acf63c24d31a3e106ecc506fb3
2019-09-19 23:41:12 -07:00
Mitchell Jameson 9c1cfc27a5 Declare that the arista plugin provides L2 connectivity
This allows the arista mech driver to bind ports without
a fixed IP (see https://review.opendev.org/#/c/678027/)

Change-Id: I0f0859da7311a22f878fa673ca67898d7e154313
2019-09-19 16:47:18 -07:00
Nader Lahouti e100142df3 Removed creation of INTERNAL-TENANT-ID
With previous patch the INTERNAL-TENANT-ID was used, instead of blank project_id,
for creating L3 HA network on CVX. This patch removes the use of
INTERNAL-TENANT-ID and instead it uses the project_id from HA router for
creating network, or port resources on CVX.

Change-Id: I632ce29f934d2e3cc96032e2baeee7e96f20d8f3
2019-06-14 12:56:52 -07:00
Nader Lahouti 094b199a71 Create network when project_id is an empty string
If L3 HA is enabled in neutron, by creating a router, a HA network with
no project_id is created. With this patch Arista ML2 driver uses an internal
project_id, i.e. 'INTERNAL-TENANT-ID', to set the project_id of the network when
creating it on the CVX.

Change-Id: Ifb9ce0a4594706945cef47321d902aa07a5944dd
2019-06-06 15:37:38 -07:00
Nader Lahouti 07ce6b1fc6 Filter segments for network_id with empty project_id
Network with empty project_id is not supported on CVX. This patch
filters segments with network_ids that have empty project_id

Change-Id: I8f1f6f48f0ab7e05ca0130157199aeca34ea25e2
2019-04-16 12:44:08 -07:00
Nader Lahouti ea44ae843f Return networks with non-empty project_id
When query for networks, only return networks where project_id is not an empty
string

Change-Id: I2ec8371d22790289259c50934ac7c41e2ae1e584
2019-04-11 16:08:57 -07:00
Boden R bfc8a3932d use trunk constants from neutron-lib
The trunk constants live in neutron-lib now. This patch switches over
to them in prep for https://review.openstack.org/#/c/649672/

Change-Id: I2642269c3554cb4d4b0d31aae2597f3476b3b487
2019-04-05 09:22:39 -06:00
Mitchell Jameson 8cbac99fdb Add another test mech driver for scale simulation
This driver immediately sets ports to ACTIVE upon being bound
to simulate OVS/LinuxBridge agent operation when utilizing
the fake.FakeDriver compute driver.

Change-Id: Ia0c89aa00c1998fdf64a81113c1a355f44719fa1
2019-04-03 13:00:06 -07:00
Boden R 295a39c4a4 remove noqa use of neutron.db.api
With the rehoming of [1] there should no longer be a need to import
neutron.db.api as per the bug mentioned in [1]. This patch removes
the noqa import of that module and bumps the min version of neutron-lib
up to 1.23.0

[1] https://review.openstack.org/#/c/625332/

Change-Id: Ie8e6eabd6c32dd6dbde4d02b0884fe8764aa906c
2019-02-11 09:32:30 -07:00
Mitchell Jameson 964055c2e5 Add unit test for router_gateway ports in the L3 plugin
This test ensures that we don't create SVIs/VLANs for router_gateway
ports.

Change-Id: I0b10936052cce162731fabe902dcf6226deab67a
2018-12-18 16:10:29 -08:00
Mitchell Jameson 4c70351150 Only create SVIs for router_interface ports in sync worker
We were filtering ports only by device_id for the purpose of SVI/VLAN
creation. We only create SVIs for network:router_interface ports in the
driver, so the same should hold for the sync worker.

Change-Id: I31f6229b3c50b0c57ecbfb32de99ec080070cb94
2018-12-18 14:44:14 -08:00
Mark McClain a80268e6b8 Make protected_vlans valid range inclusive
Change-Id: Ife31165251ae4bd5aa6589ac8bf278d6e2192c38
2018-12-12 16:49:22 +00:00
Zuul 1bedf00ac1 Merge "Fix a number of HA bugs" 2018-11-27 17:40:07 +00:00
Zuul 53ebe51bc4 Merge "Add a test driver to simulate running Neutron in HA deployments" 2018-11-27 00:15:11 +00:00
Mitchell Jameson 6cc0bcb1ab Fix a number of HA bugs
1. Ensure port->network dependency is enforced in update_port_postcommit
2. Always send creates if resource in DB (resource may have been deleted by
   another worker)
3. If resource in DB, do not send DELETE, send a POST instead
   (indicates resource was recreated)
4. Ignore 'Unkown port id' in errors in DELETEs
5. Track that a sync is still necessary when sync lock is not grabbed
6. DB queries must be done with the sync lock to avoid race conditions
7. Run sync worker in separate process to avoid blocking other workers

Change-Id: I25b4c55d77a5a00087d8679a5323ab956f3b9665
2018-11-26 15:53:18 -08:00
Mitchell Jameson 799a87a651 Add a test driver to simulate running Neutron in HA deployments
This mech driver will essentially randomly distribute mech driver
updates randomly to one of 3 Arista sync workers in an effort to
simulate a neutron HA deployment (where there would be 3 mech drivers
distributing updates to 3 workers.)

Change-Id: I672b762e327d8a4cb54018cc3f8807725dce075b
2018-11-20 15:20:55 -08:00
Mitchell Jameson 2e36773c2d Add ability to cleanup L3 resources
This adds two new config settings: enable_cleanup and protected_vlans
that allows the L3 sync worker to cleanup stale VRFs, SVIs and VLANs
on L3 hosts without affecting config from sources that are not the Arista
L3 plugin. This change also adds support for automatic config file
generation with oslo-config-generator.

Change-Id: Ia1f151e7e54a7d8712279aa0d7b3adf7731feaab
2018-11-19 10:27:17 -08:00
Zuul 53edc6aa3e Merge "Load listeners to expire stale objects from session" 2018-11-15 20:44:39 +00:00
Mitchell Jameson b3227599c5 Load listeners to expire stale objects from session
In 2 trunk port tests, when deleting a subport, the stale trunk
(that still had the subport) was loaded from the session and an attempt
was made to write the stale trunk to the DB resulting in a foreign key
error since the subport has been deleted from the DB.

The fix is to start the listeners in neutron.db.api that expire
objects from the session when a foreign key is deleted or created.

(I also added a global var to enable neutron logging as I was using it
for debugging)

Change-Id: I52e2918bddc90a44d14d68fbfde639010e06803e
2018-11-14 18:15:42 -08:00
Zuul 3adf6272bd Merge "Add support for VRFs on MLAGs" 2018-08-21 20:47:47 +00:00
Mitchell Jameson bd3d794e01 Add support for VRFs on MLAGs
Also:
- Improved error logging for L3/SG/arista_vlan
- Fixed tenant_id filter for router query
- Fixed VRF creation for routers with a space in their name

Change-Id: I7917b988d3e45e653a19c791b8529077ba93389b
2018-08-20 10:03:47 -07:00