External subnets with DHCP enabled should not be ignored
Tobiko considers no external networks exist when the existing one have no subnets with DHCP disabled. With this patch, any external network with subnets is accepted, regardless of having DHCP enabled or disabled. Related-Issue: https://issues.redhat.com/browse/TOBIKO-105 Change-Id: Ib2e00fc0581e08abe55a903c167ad70f4490c506
This commit is contained in:
@@ -49,42 +49,26 @@ class ExternalNetworkStackFixture(heat.HeatStackFixture):
|
|||||||
def external_name(self) -> typing.Optional[str]:
|
def external_name(self) -> typing.Optional[str]:
|
||||||
return tobiko.tobiko_config().neutron.external_network
|
return tobiko.tobiko_config().neutron.external_network
|
||||||
|
|
||||||
subnet_enable_dhcp: typing.Optional[bool] = False
|
|
||||||
|
|
||||||
_external_network: typing.Optional[neutron.NetworkType] = None
|
_external_network: typing.Optional[neutron.NetworkType] = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def external_network(self) -> typing.Optional[neutron.NetworkType]:
|
def external_network(self) -> typing.Optional[neutron.NetworkType]:
|
||||||
external_network = self._external_network
|
external_network = self._external_network
|
||||||
if external_network is None:
|
if external_network is None:
|
||||||
subnet_parameters: typing.Dict[str, typing.Any] = {}
|
|
||||||
if self.subnet_enable_dhcp is not None:
|
|
||||||
subnet_parameters['enable_dhcp'] = self.subnet_enable_dhcp
|
|
||||||
for network in list_external_networks(name=self.external_name):
|
for network in list_external_networks(name=self.external_name):
|
||||||
if not network['subnets']:
|
if not network['subnets']:
|
||||||
LOG.debug(f"Network '{network['id']}' has any subnet")
|
LOG.debug(f"Network '{network['id']}' has no subnet")
|
||||||
continue
|
|
||||||
subnets = neutron.list_subnets(network_id=network['id'],
|
|
||||||
**subnet_parameters)
|
|
||||||
if not subnets:
|
|
||||||
LOG.debug(f"Network '{network['id']}' has any valid "
|
|
||||||
f"subnet: {subnet_parameters}")
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
network_dump = json.dumps(network, indent=4, sort_keys=True)
|
network_dump = json.dumps(network, indent=4, sort_keys=True)
|
||||||
LOG.debug(f"Found external network for {self.fixture_name}:\n"
|
LOG.debug(f"Found external network for {self.fixture_name}:\n"
|
||||||
f"{network_dump}")
|
f"{network_dump}")
|
||||||
|
|
||||||
subnets_dump = json.dumps(subnets, indent=4, sort_keys=True)
|
|
||||||
LOG.debug(f"External subnets for {self.fixture_name}:\n"
|
|
||||||
f"{subnets_dump}")
|
|
||||||
self._external_network = external_network = network
|
self._external_network = external_network = network
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
LOG.warning("No external network found for "
|
LOG.warning("No external network found for "
|
||||||
f"'{self.fixture_name}':\n"
|
f"'{self.fixture_name}':\n"
|
||||||
f" - name or ID: {self.external_name}\n"
|
f" - name or ID: {self.external_name}\n")
|
||||||
f" - subnet attributes: {subnet_parameters}\n")
|
|
||||||
return external_network
|
return external_network
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -155,8 +139,6 @@ class RouterStackFixture(ExternalNetworkStackFixture):
|
|||||||
def external_name(self) -> typing.Optional[str]:
|
def external_name(self) -> typing.Optional[str]:
|
||||||
return tobiko.tobiko_config().neutron.floating_network
|
return tobiko.tobiko_config().neutron.floating_network
|
||||||
|
|
||||||
subnet_enable_dhcp = None
|
|
||||||
|
|
||||||
distributed: typing.Optional[bool] = None
|
distributed: typing.Optional[bool] = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|||||||
Reference in New Issue
Block a user