From 05ba4257dec5e80565aedb49685d8784424be461 Mon Sep 17 00:00:00 2001 From: Slawek Kaplonski Date: Thu, 20 Apr 2023 13:13:47 +0200 Subject: [PATCH] Remove creation of DHCP port in the OVN metadata unit test It's not needed to create such port manually as it will be always created by neutron when subnet is created. Co-Authored-By: Rodolfo Alonso Hernandez Trivial-Fix Change-Id: I9499678fe244187977576cece101e28aa359a0d7 --- .../ovn/mech_driver/test_mech_driver.py | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py b/neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py index 72e1ce4b749..50432450d11 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py +++ b/neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py @@ -4176,19 +4176,13 @@ class TestOVNMechanismDriverMetadataPort(MechDriverSetupBase, 'subnet': {}, 'ports': {}} with self.network(set_context=True, tenant_id='test') as net1: with self.subnet(network=net1, cidr='10.0.0.0/24') as subnet1: - # Create a network:dhcp owner port just as how Neutron DHCP - # agent would do. - with self.port(subnet=subnet1, - device_owner=const.DEVICE_OWNER_DISTRIBUTED, - device_id='dhcpxxxx', - set_context=True, tenant_id='test'): - with self.subnet(network=net1, - cidr='20.0.0.0/24') as subnet2: - self.assertEqual( - 2, self.nb_ovn.set_lswitch_port.call_count) - args, kwargs = self.nb_ovn.set_lswitch_port.call_args - self.assertEqual(ovn_const.LSP_TYPE_LOCALPORT, - kwargs['type']) + with self.subnet(network=net1, + cidr='20.0.0.0/24') as subnet2: + self.assertEqual( + 2, self.nb_ovn.set_lswitch_port.call_count) + args, kwargs = self.nb_ovn.set_lswitch_port.call_args + self.assertEqual(ovn_const.LSP_TYPE_LOCALPORT, + kwargs['type']) port_ips = kwargs['external_ids'].get( ovn_const.OVN_CIDRS_EXT_ID_KEY, '').split() port_cidrs = [str(netaddr.IPNetwork(cidr).cidr) for cidr in port_ips]