Skip to content

Commit 2bf242a

Browse files
committed
[OVN] Fix availability zones changes check
Closes-Bug: #2000634 Change-Id: Id5f34ec858a940d2fc4a03b9290adc6161aa9db3 (cherry picked from commit 5e19eaa)
1 parent 0e18664 commit 2bf242a

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1987,7 +1987,7 @@ def update_network(self, context, network, original_network=None):
19871987
if any([p for p in lswitch.ports if
19881988
p.type == ovn_const.LSP_TYPE_EXTERNAL]):
19891989
# Check for changes in the network Availability Zones
1990-
ovn_ls_azs = lswitch_name.external_ids.get(
1990+
ovn_ls_azs = lswitch.external_ids.get(
19911991
ovn_const.OVN_AZ_HINTS_EXT_ID_KEY, '')
19921992
neutron_net_azs = lswitch_params['external_ids'].get(
19931993
ovn_const.OVN_AZ_HINTS_EXT_ID_KEY, '')

neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,40 @@ def test_external_port_update_switchdev_vnic_direct_physical(self):
790790
def test_external_port_update_switchdev_vnic_macvtap(self):
791791
self._test_external_port_update_switchdev(portbindings.VNIC_MACVTAP)
792792

793+
def test_external_port_network_update(self):
794+
net_id = self.n1['network']['id']
795+
port_data = {
796+
'port': {'network_id': net_id,
797+
'tenant_id': self._tenant_id,
798+
portbindings.VNIC_TYPE: 'direct'}}
799+
800+
# Create external port
801+
port_req = self.new_create_request('ports', port_data, self.fmt)
802+
port_res = port_req.get_response(self.api)
803+
port = self.deserialize(self.fmt, port_res)['port']
804+
ovn_port = self._find_port_row_by_name(port['id'])
805+
self.assertEqual(ovn_const.LSP_TYPE_EXTERNAL, ovn_port.type)
806+
# Update MTU of network with external port
807+
mtu_value = self.n1['network']['mtu'] - 100
808+
dhcp_options = (
809+
self.mech_driver._ovn_client._nb_idl.get_subnet_dhcp_options(
810+
self.sub['subnet']['id'])
811+
)
812+
self.assertNotEqual(
813+
int(dhcp_options['subnet']['options']['mtu']),
814+
mtu_value)
815+
data = {'network': {'mtu': mtu_value}}
816+
req = self.new_update_request(
817+
'networks', data, self.n1['network']['id'], self.fmt)
818+
req.get_response(self.api)
819+
dhcp_options = (
820+
self.mech_driver._ovn_client._nb_idl.get_subnet_dhcp_options(
821+
self.sub['subnet']['id'])
822+
)
823+
self.assertEqual(
824+
int(dhcp_options['subnet']['options']['mtu']),
825+
mtu_value)
826+
793827

794828
class TestSecurityGroup(base.TestOVNFunctionalBase):
795829

0 commit comments

Comments
 (0)