Skip to content

Commit 40de591

Browse files
authored
Merge pull request #121 from stackhpc/upstream/zed-2024-02-12
Synchronise zed with upstream
2 parents 37b6ff4 + f83e1fd commit 40de591

File tree

16 files changed

+58
-720
lines changed

16 files changed

+58
-720
lines changed

doc/source/admin/config-ovs-offload.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ Validate Open vSwitch hardware offloading
355355

356356
.. code-block:: bash
357357
358-
# openstack port create --network private --vnic-type=direct --binding-profile '{"capabilities": ["switchdev"]}' direct_port1
358+
# openstack port create --network private --vnic-type=direct direct_port1
359359
360360
361361
#. Create an instance using the direct port on 'First Compute Node'
@@ -369,7 +369,7 @@ Validate Open vSwitch hardware offloading
369369

370370
.. code-block:: bash
371371
372-
# openstack port create --network private --vnic-type=direct --binding-profile '{"capabilities": ["switchdev"]}' direct_port2
372+
# openstack port create --network private --vnic-type=direct direct_port2
373373
# openstack server create --flavor m1.small --image mellanox_fedora --nic port-id=direct_port2 vm2
374374
375375
.. note::

doc/source/contributor/internals/openvswitch_agent.rst

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ The IDs used for bridge and port names are truncated.
494494
| tbr-trunk-id |
495495
| |
496496
| tpt-parent-id spt-subport-id |
497-
| (tag 100) |
497+
| (tag 0) (tag 100) |
498498
+-----+-----------------+--------+
499499
| |
500500
| |
@@ -514,27 +514,27 @@ spi-subport-id: int bridge side of the patch port that implements a subport.
514514
Trunk creation
515515
++++++++++++++
516516

517-
A VM is spawned passing to Nova the port-id of a parent port associated with
518-
a trunk. Neutron will pass to Nova the bridge where to plug the vif as part of the vif details.
519-
The os-vif driver creates the trunk bridge tbr-trunk-id if it does not exist in plug().
520-
It will create the tap interface tap1 and plug it into tbr-trunk-id setting the parent port ID in the external-ids.
521-
The OVS agent will be monitoring the creation of ports on the trunk bridges. When it detects
522-
that a new port has been created on the trunk bridge, it will do the following:
517+
A VM is spawned passing to Nova the port-id of a parent port associated
518+
with a trunk. Neutron will pass to Nova the bridge where to plug the
519+
vif as part of the vif details. The os-vif driver creates the trunk
520+
bridge tbr-trunk-id if it does not exist in plug(). It will create the
521+
tap interface tap1 and plug it into tbr-trunk-id setting the parent port
522+
ID in the external-ids. The trunk driver will wire the parent port via
523+
a patch port to connect the trunk bridge to the integration bridge:
523524

524525
::
525526

526-
ovs-vsctl add-port tbr-trunk-id tpt-parent-id -- set Interface tpt-parent-id type=patch options:peer=tpi-parent-id
527-
ovs-vsctl add-port br-int tpi-parent-id tag=3 -- set Interface tpi-parent-id type=patch options:peer=tpt-parent-id
527+
ovs-vsctl add-port tbr-trunk-id tpt-parent-id -- set Interface tpt-parent-id type=patch options:peer=tpi-parent-id -- set Port tpt-parent-id vlan_mode=access tag=0
528+
ovs-vsctl add-port br-int tpi-parent-id -- set Interface tpi-parent-id type=patch options:peer=tpt-parent-id
528529

529530

530-
A patch port is created to connect the trunk bridge to the integration bridge.
531-
tpt-parent-id, the trunk bridge side of the patch is not associated to any
532-
tag. It will carry untagged traffic.
533-
tpi-parent-id, the br-int side the patch port is tagged with VLAN 3. We assume that the
534-
trunk is on network1 that on this host is associated with VLAN 3.
535-
The OVS agent will set the trunk ID in the external-ids of tpt-parent-id and tpi-parent-id.
536-
If the parent port is associated with one or more subports the agent will process them as
537-
described in the next paragraph.
531+
tpt-parent-id, the trunk bridge side of the patch will carry untagged
532+
traffic (vlan_mode=access tag=0). The OVS agent will be monitoring the
533+
creation of ports on the integration bridge. tpi-parent-id, the br-int
534+
side the patch port is tagged with VLAN 3 by ovs-agent. We assume that
535+
the trunk is on network1 that on this host is associated with VLAN 3.
536+
If the parent port is associated with one or more subports the agent
537+
will process them as described in the next paragraph.
538538

539539
Subport creation
540540
++++++++++++++++

neutron/services/trunk/drivers/openvswitch/agent/trunk_manager.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def __init__(self, trunk_id, port_id, port_mac=None):
9191
self.DEV_PREFIX, port_id)
9292
self._transaction = None
9393

94-
def plug(self, br_int):
94+
def plug(self, br_int, tag=0):
9595
"""Plug patch ports between trunk bridge and given bridge.
9696
9797
The method plugs one patch port on the given bridge side using
@@ -124,6 +124,9 @@ def plug(self, br_int):
124124
self.patch_port_trunk_name))
125125
txn.add(ovsdb.db_set('Interface', self.patch_port_trunk_name,
126126
*patch_trunk_attrs))
127+
txn.add(ovsdb.db_set('Port', self.patch_port_trunk_name,
128+
('vlan_mode', 'access'),
129+
('tag', tag)))
127130

128131
def unplug(self, bridge):
129132
"""Unplug the trunk from bridge.
@@ -168,12 +171,7 @@ def plug(self, br_int):
168171
:param br_int: an integration bridge where peer endpoint of patch port
169172
will be created.
170173
"""
171-
ovsdb = self.bridge.ovsdb
172-
with ovsdb.transaction() as txn:
173-
super(SubPort, self).plug(br_int)
174-
txn.add(ovsdb.db_set(
175-
"Port", self.patch_port_trunk_name,
176-
("tag", self.segmentation_id)))
174+
super(SubPort, self).plug(br_int, tag=self.segmentation_id)
177175

178176
def unplug(self, bridge):
179177
"""Unplug the sub port from the bridge.

neutron/tests/fullstack/agents/ovs_agent.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,9 @@
2222
from neutron.agent.common import polling
2323
from neutron.agent.l2.extensions import qos as qos_extension
2424
from neutron.common import config
25-
from neutron.services.trunk.drivers.openvswitch.agent \
26-
import driver as trunk_driver
2725
from neutron.tests.common.agents import ovs_agent
2826

2927

30-
def monkeypatch_init_handler():
31-
original_handler = trunk_driver.init_handler
32-
33-
def new_init_handler(resource, event, trigger, payload=None):
34-
# NOTE(slaweq): make this setup conditional based on server-side
35-
# capabilities for fullstack tests we can assume that server-side
36-
# and agent-side conf are in sync
37-
if "trunk" not in cfg.CONF.service_plugins:
38-
return
39-
original_handler(resource, event, trigger, payload)
40-
41-
trunk_driver.init_handler = new_init_handler
42-
43-
4428
def monkeypatch_qos():
4529
mock.patch.object(ovs_lib.OVSBridge, 'clear_bandwidth_qos').start()
4630
if "qos" in cfg.CONF.service_plugins:
@@ -63,7 +47,6 @@ def main():
6347
# ovs-vswitchd processes for each test will be isolated in separate
6448
# namespace
6549
config.register_common_config_options()
66-
monkeypatch_init_handler()
6750
monkeypatch_qos()
6851
monkeypatch_event_filtering()
6952
ovs_agent.main()

neutron/tests/fullstack/test_connectivity.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -83,22 +83,6 @@ def _test_connectivity(self):
8383
vms.ping_all()
8484

8585

86-
class TestOvsConnectivitySameNetwork(BaseConnectivitySameNetworkTest):
87-
88-
l2_agent_type = constants.AGENT_TYPE_OVS
89-
scenarios = [
90-
('VXLAN', {'network_type': 'vxlan',
91-
'l2_pop': False}),
92-
('GRE-l2pop-arp_responder', {'network_type': 'gre',
93-
'l2_pop': True,
94-
'arp_responder': True}),
95-
('VLANs', {'network_type': 'vlan',
96-
'l2_pop': False})]
97-
98-
def test_connectivity(self):
99-
self._test_connectivity()
100-
101-
10286
class TestOvsConnectivitySameNetworkOnOvsBridgeControllerStop(
10387
BaseConnectivitySameNetworkTest):
10488

neutron/tests/fullstack/test_dhcp_agent.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,6 @@ class TestDhcpAgentNoHA(BaseDhcpAgentTest):
9191
number_of_hosts = 1
9292
agent_down_time = 60
9393

94-
def test_dhcp_assignment(self):
95-
# First check if network was scheduled to one DHCP agent
96-
dhcp_agents = self.client.list_dhcp_agent_hosting_networks(
97-
self.network['id'])
98-
self.assertEqual(1, len(dhcp_agents['agents']))
99-
100-
# And check if IP and gateway config is fine on FakeMachine
101-
self.vm.block_until_dhcp_config_done()
102-
10394
def test_mtu_update(self):
10495
# The test case needs access to devices in nested namespaces. ip_lib
10596
# doesn't support it, and it's probably unsafe to touch the library for

neutron/tests/fullstack/test_l3_agent.py

Lines changed: 0 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import os
1717
import time
1818

19-
import netaddr
2019
from neutron_lib import constants
2120
from neutronclient.common import exceptions
2221
from oslo_utils import uuidutils
@@ -323,18 +322,6 @@ def setUp(self):
323322
host_descriptions)
324323
super(TestLegacyL3Agent, self).setUp(env)
325324

326-
def test_namespace_exists(self):
327-
tenant_id = uuidutils.generate_uuid()
328-
329-
router = self.safe_client.create_router(tenant_id)
330-
network = self.safe_client.create_network(tenant_id)
331-
subnet = self.safe_client.create_subnet(
332-
tenant_id, network['id'], '20.0.0.0/24', gateway_ip='20.0.0.1')
333-
self.safe_client.add_router_interface(router['id'], subnet['id'])
334-
335-
namespace = self._get_namespace(router['id'])
336-
self.assert_namespace_exists(namespace)
337-
338325
def test_mtu_update(self):
339326
tenant_id = uuidutils.generate_uuid()
340327

@@ -361,92 +348,6 @@ def test_mtu_update(self):
361348
network = self.safe_client.update_network(network['id'], mtu=mtu)
362349
common_utils.wait_until_true(lambda: ri_dev.link.mtu == mtu)
363350

364-
def test_east_west_traffic(self):
365-
tenant_id = uuidutils.generate_uuid()
366-
router = self.safe_client.create_router(tenant_id)
367-
368-
vm1 = self._create_net_subnet_and_vm(
369-
tenant_id, ['20.0.0.0/24', '2001:db8:aaaa::/64'],
370-
self.environment.hosts[0], router)
371-
vm2 = self._create_net_subnet_and_vm(
372-
tenant_id, ['21.0.0.0/24', '2001:db8:bbbb::/64'],
373-
self.environment.hosts[1], router)
374-
375-
vm1.block_until_ping(vm2.ip)
376-
# Verify ping6 from vm2 to vm1 IPv6 Address
377-
vm2.block_until_ping(vm1.ipv6)
378-
379-
def test_north_south_traffic(self):
380-
# This function creates an external network which is connected to
381-
# central_bridge and spawns an external_vm on it.
382-
# The external_vm is configured with the gateway_ip (both v4 & v6
383-
# addresses) of external subnet. Later, it creates a tenant router,
384-
# a tenant network and two tenant subnets (v4 and v6). The tenant
385-
# router is associated with tenant network and external network to
386-
# provide north-south connectivity to the VMs.
387-
# We validate the following in this testcase.
388-
# 1. SNAT support: using ping from tenant VM to external_vm
389-
# 2. Floating IP support: using ping from external_vm to VM floating ip
390-
# 3. IPv6 ext connectivity: using ping6 from tenant vm to external_vm.
391-
tenant_id = uuidutils.generate_uuid()
392-
ext_net, ext_sub = self._create_external_network_and_subnet(tenant_id)
393-
external_vm = self._create_external_vm(ext_net, ext_sub)
394-
# Create an IPv6 subnet in the external network
395-
v6network = self.useFixture(
396-
ip_network.ExclusiveIPNetwork(
397-
"2001:db8:1234::1", "2001:db8:1234::10", "64")).network
398-
# NOTE(ykarel): gateway_ip is explicitly added as iputils package
399-
# requires fix for https://github.com/iputils/iputils/issues/371
400-
# is not available in CentOS 9-Stream
401-
ext_v6sub = self.safe_client.create_subnet(
402-
tenant_id, ext_net['id'], v6network, gateway_ip='2001:db8:1234::1')
403-
404-
router = self.safe_client.create_router(tenant_id,
405-
external_network=ext_net['id'])
406-
407-
# Configure the gateway_ip of external v6subnet on the external_vm.
408-
external_vm.ipv6_cidr = common_utils.ip_to_cidr(
409-
ext_v6sub['gateway_ip'], 64)
410-
411-
# Configure an IPv6 downstream route to the v6Address of router gw port
412-
for fixed_ip in router['external_gateway_info']['external_fixed_ips']:
413-
if netaddr.IPNetwork(fixed_ip['ip_address']).version == 6:
414-
external_vm.set_default_gateway(fixed_ip['ip_address'])
415-
416-
vm = self._create_net_subnet_and_vm(
417-
tenant_id, ['20.0.0.0/24', '2001:db8:aaaa::/64'],
418-
self.environment.hosts[1], router)
419-
420-
# ping external vm to test snat
421-
vm.block_until_ping(external_vm.ip)
422-
423-
fip = self.safe_client.create_floatingip(
424-
tenant_id, ext_net['id'], vm.ip, vm.neutron_port['id'])
425-
426-
# ping floating ip from external vm
427-
external_vm.block_until_ping(fip['floating_ip_address'])
428-
429-
# Verify VM is able to reach the router interface.
430-
vm.block_until_ping(vm.gateway_ipv6)
431-
# Verify north-south connectivity using ping6 to external_vm.
432-
vm.block_until_ping(external_vm.ipv6)
433-
434-
# Now let's remove and create again phys bridge and check connectivity
435-
# once again
436-
br_phys = self.environment.hosts[0].br_phys
437-
br_phys.destroy()
438-
br_phys.create()
439-
self.environment.hosts[0].connect_to_central_network_via_vlans(
440-
br_phys)
441-
442-
# ping floating ip from external vm
443-
external_vm.block_until_ping(fip['floating_ip_address'])
444-
445-
# Verify VM is able to reach the router interface.
446-
vm.block_until_ping(vm.gateway_ipv6)
447-
# Verify north-south connectivity using ping6 to external_vm.
448-
vm.block_until_ping(external_vm.ipv6)
449-
450351
def test_gateway_ip_changed(self):
451352
self._test_gateway_ip_changed()
452353

0 commit comments

Comments
 (0)