From 9115c8e4af0e476cb1c119a6f6eb4887660979f6 Mon Sep 17 00:00:00 2001 From: Slawek Kaplonski Date: Tue, 6 Jul 2021 13:50:17 +0200 Subject: [PATCH] Fix test_allocate_ips_are_from_correct_subnet on ML2/OVN backend In case of ML2/OVN, driver creates additional network:distributed port for each subnet with enabled DHCP. That caused failures of that test in the ML2/OVN environment as subnets created in the test had only some specified service_type thus Neutron couldn't find any IP address to allocate for the "network:distributed" port. Now it's fixed by adding "network:distributed" service_type to both subnets. Closes-Bug: #1934622 Change-Id: Ifc2c75abd49209625065de6fece413aed0bb7a4e --- neutron_tempest_plugin/api/test_subnets.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/neutron_tempest_plugin/api/test_subnets.py b/neutron_tempest_plugin/api/test_subnets.py index d4992d35..3b075d5d 100644 --- a/neutron_tempest_plugin/api/test_subnets.py +++ b/neutron_tempest_plugin/api/test_subnets.py @@ -86,12 +86,18 @@ class SubnetServiceTypeTestJSON(base.BaseNetworkTest): cidr_1 = netaddr.IPNetwork('192.168.1.0/24') cidr_2 = netaddr.IPNetwork('192.168.2.0/24') - self.create_subnet(self.network, - service_types=['test:type_1'], - cidr=str(cidr_1)) - self.create_subnet(self.network, - service_types=['test:type_2'], - cidr=str(cidr_2)) + # NOTE(slaweq): service_type "network:distributed" is needed for + # ML2/OVN backend. It's needed because OVN driver creates additional + # port for metadata service in each subnet with enabled dhcp and such + # port needs to have allocated IP address from the subnet also. + self.create_subnet( + self.network, + service_types=['test:type_1', 'network:distributed'], + cidr=str(cidr_1)) + self.create_subnet( + self.network, + service_types=['test:type_2', 'network:distributed'], + cidr=str(cidr_2)) port_type_1 = self.create_port(self.network, device_owner="test:type_1") port_type_2 = self.create_port(self.network,