Parcourir la source

Add Neutron network id to OVN LRPs

This patch is adding an external_id to the Logical_Router_Port
rows including the Neutron network ID.

The reason for this is that if we consume Octavia from Stein+ in
Rocky/Queens, this external id is missing and the OVN Octavia
driver (octavia_api) will not be able to apply the Load Balancers
to all the Logical Switches and Logical Routers where needed.

Note: This is a partial cherry-pick from
https://review.opendev.org/#/c/668397/ since Octavia itself
does not exist in stable/rocky but can be made to work
with neutron's stable/rocky.

Change-Id: I4a0614afda8d2c2b8ccbb2583bc339a232fc802e
Co-Authored-By: Daniel Alvarez <dalvarez@redhat.com>
Closes-Bug: #1855328
Related-Bug: #1794260
(cherry picked from commit aa4268a094)
tags/5.1.0
Flavio Fernandes il y a 4 mois
Parent
révision
5fae8f68a0
2 fichiers modifiés avec 15 ajouts et 5 suppressions
  1. +3
    -1
      networking_ovn/common/ovn_client.py
  2. +12
    -4
      networking_ovn/tests/unit/l3/test_l3_ovn.py

+ 3
- 1
networking_ovn/common/ovn_client.py Voir le fichier

@@ -1108,7 +1108,9 @@ class OVNClient(object):
ovn_const.OVN_REV_NUM_EXT_ID_KEY: str(utils.get_revision_number(
port, ovn_const.TYPE_ROUTER_PORTS)),
ovn_const.OVN_SUBNET_EXT_IDS_KEY:
' '.join(utils.get_port_subnet_ids(port))}
' '.join(utils.get_port_subnet_ids(port)),
ovn_const.OVN_NETWORK_NAME_EXT_ID_KEY:
utils.ovn_name(port['network_id'])}

router_id = port.get('device_id')
if router_id:


+ 12
- 4
networking_ovn/tests/unit/l3/test_l3_ovn.py Voir le fichier

@@ -55,6 +55,7 @@ class OVNL3RouterPlugin(test_mech_driver.OVNMechanismDriverTestCase):
self.fake_network = \
fakes.FakeNetwork.create_one_network(attrs=network_attrs).info()
self.fake_router_port = {'device_id': '',
'network_id': self.fake_network['id'],
'device_owner': 'network:router_interface',
'mac_address': 'aa:aa:aa:aa:aa:aa',
'fixed_ips': [{'ip_address': '10.0.0.100',
@@ -68,7 +69,9 @@ class OVNL3RouterPlugin(test_mech_driver.OVNMechanismDriverTestCase):
'networks': ['10.0.0.100/24'],
'external_ids': {
ovn_const.OVN_SUBNET_EXT_IDS_KEY: 'subnet-id',
ovn_const.OVN_REV_NUM_EXT_ID_KEY: '1'}}
ovn_const.OVN_REV_NUM_EXT_ID_KEY: '1',
ovn_const.OVN_NETWORK_NAME_EXT_ID_KEY:
utils.ovn_name(self.fake_network['id'])}}
self.fake_router_ports = [self.fake_router_port]
self.fake_subnet = {'id': 'subnet-id',
'ip_version': 4,
@@ -122,7 +125,9 @@ class OVNL3RouterPlugin(test_mech_driver.OVNMechanismDriverTestCase):
'may_exist': True,
'external_ids': {
ovn_const.OVN_SUBNET_EXT_IDS_KEY: 'ext-subnet-id',
ovn_const.OVN_REV_NUM_EXT_ID_KEY: '1'},
ovn_const.OVN_REV_NUM_EXT_ID_KEY: '1',
ovn_const.OVN_NETWORK_NAME_EXT_ID_KEY:
utils.ovn_name(self.fake_network['id'])},
'gateway_chassis': ['hv1']}
self.fake_floating_ip_attrs = {'floating_ip_address': '192.168.0.10',
'fixed_ip_address': '10.0.0.10'}
@@ -245,7 +250,8 @@ class OVNL3RouterPlugin(test_mech_driver.OVNMechanismDriverTestCase):
'fixed_ips': [
{'ip_address': '2001:db8::1', 'subnet_id': 'subnet-id1'},
{'ip_address': '2001:dba::1', 'subnet_id': 'subnet-id2'}],
'mac_address': 'aa:aa:aa:aa:aa:aa'
'mac_address': 'aa:aa:aa:aa:aa:aa',
'network_id': 'network-id1'
}
fake_rtr_intf_networks = ['2001:db8::1/24', '2001:dba::1/24']
self.l3_inst.add_router_interface(self.context, router_id,
@@ -287,7 +293,9 @@ class OVNL3RouterPlugin(test_mech_driver.OVNMechanismDriverTestCase):
networks=['10.0.0.100/24'],
external_ids={
ovn_const.OVN_SUBNET_EXT_IDS_KEY: 'subnet-id',
ovn_const.OVN_REV_NUM_EXT_ID_KEY: '1'})
ovn_const.OVN_REV_NUM_EXT_ID_KEY: '1',
ovn_const.OVN_NETWORK_NAME_EXT_ID_KEY:
utils.ovn_name(self.fake_network['id'])})

@mock.patch('neutron.db.extraroute_db.ExtraRoute_dbonly_mixin.'
'update_router')


Chargement…
Annuler
Enregistrer