diff --git a/neutron/tests/fullstack/base.py b/neutron/tests/fullstack/base.py index 2da8c845d64..71e634f10b8 100644 --- a/neutron/tests/fullstack/base.py +++ b/neutron/tests/fullstack/base.py @@ -172,6 +172,8 @@ class BaseFullStackTestCase(testlib_api.MySQLTestCaseMixin, for host in self.environment.hosts) vms.block_until_all_boot() + if use_dhcp: + vms.block_until_all_dhcp_config_done() return vms def assert_namespace_exists(self, ns_name): diff --git a/neutron/tests/fullstack/resources/machine.py b/neutron/tests/fullstack/resources/machine.py index c50cddfba7a..b9ccef079ea 100644 --- a/neutron/tests/fullstack/resources/machine.py +++ b/neutron/tests/fullstack/resources/machine.py @@ -38,6 +38,10 @@ class FakeFullstackMachinesList(list): for vm in self: vm.block_until_boot() + def block_until_all_dhcp_config_done(self): + for vm in self: + vm.block_until_dhcp_config_done() + def ping_all(self): # Generate an iterable of all unique pairs. For example: # itertools.permutations(range(3), 2) results in: diff --git a/neutron/tests/fullstack/test_connectivity.py b/neutron/tests/fullstack/test_connectivity.py index 41a53aba9e5..b0249836729 100644 --- a/neutron/tests/fullstack/test_connectivity.py +++ b/neutron/tests/fullstack/test_connectivity.py @@ -37,7 +37,7 @@ LOG = logging.getLogger(__name__) class BaseConnectivitySameNetworkTest(base.BaseFullStackTestCase): arp_responder = False - use_dhcp = True + use_dhcp = False num_hosts = 3 @@ -166,23 +166,6 @@ class TestLinuxBridgeConnectivitySameNetwork(BaseConnectivitySameNetworkTest): self._test_connectivity() -class TestConnectivitySameNetworkNoDhcp(BaseConnectivitySameNetworkTest): - - scenarios = [ - (constants.AGENT_TYPE_OVS, - {'l2_agent_type': constants.AGENT_TYPE_OVS}), - (constants.AGENT_TYPE_LINUXBRIDGE, - {'l2_agent_type': constants.AGENT_TYPE_LINUXBRIDGE}) - ] - - use_dhcp = False - network_type = 'vxlan' - l2_pop = False - - def test_connectivity(self): - self._test_connectivity() - - class _TestUninterruptedConnectivityOnL2AgentRestart( BaseConnectivitySameNetworkTest): diff --git a/neutron/tests/fullstack/test_dhcp_agent.py b/neutron/tests/fullstack/test_dhcp_agent.py index e07f9522196..6d19a307360 100644 --- a/neutron/tests/fullstack/test_dhcp_agent.py +++ b/neutron/tests/fullstack/test_dhcp_agent.py @@ -72,6 +72,7 @@ class BaseDhcpAgentTest(base.BaseFullStackTestCase): self.safe_client, use_dhcp=True)) vm.block_until_boot() + vm.block_until_dhcp_config_done() return vm def _create_network_subnet_and_vm(self): @@ -181,8 +182,7 @@ class TestDhcpAgentHA(BaseDhcpAgentTest): self.assertEqual(1, len(new_network_dhcp_agents)) # check if new vm will get IP from new DHCP agent - new_vm = self._spawn_vm() - new_vm.block_until_dhcp_config_done() + self._spawn_vm() def test_multiple_agents_for_network(self): network_dhcp_agents = self.client.list_dhcp_agent_hosting_networks( @@ -198,8 +198,7 @@ class TestDhcpAgentHA(BaseDhcpAgentTest): self._kill_dhcp_agent(network_dhcp_agents[0]) # check if new vm will get IP from DHCP agent which is still alive - new_vm = self._spawn_vm() - new_vm.block_until_dhcp_config_done() + self._spawn_vm() class TestDhcpAgentHARaceCondition(BaseDhcpAgentTest): @@ -300,8 +299,6 @@ class TestSubnetDeleteRace(BaseDhcpAgentTest): enable_dhcp=True) self.vm = self._spawn_vm() - self.vm.block_until_boot() - self.vm.block_until_dhcp_config_done() dhcp_ports = self.safe_client.list_ports(**{ 'device_owner': 'network:dhcp', diff --git a/neutron/tests/fullstack/test_ovs_dhcp_extension.py b/neutron/tests/fullstack/test_ovs_dhcp_extension.py index 629b2a5efc9..5cce441cf2d 100644 --- a/neutron/tests/fullstack/test_ovs_dhcp_extension.py +++ b/neutron/tests/fullstack/test_ovs_dhcp_extension.py @@ -163,6 +163,7 @@ class OvsDHCPExtensionTestCase(base.BaseFullStackTestCase): def test_ovs_dhcp_agent_extension_ping_vms(self): vms = self._prepare_vms() vms.block_until_all_boot() + vms.block_until_all_dhcp_config_done() # ping -4 from vm_1 to vm_2 vms.ping_all() # ping -6 from vm_1 to vm_2 diff --git a/neutron/tests/fullstack/test_securitygroup.py b/neutron/tests/fullstack/test_securitygroup.py index 83d08da1e04..c6e300f8ca4 100644 --- a/neutron/tests/fullstack/test_securitygroup.py +++ b/neutron/tests/fullstack/test_securitygroup.py @@ -52,7 +52,7 @@ class BaseSecurityGroupsSameNetworkTest(base.BaseFullStackTestCase): environment.HostDescription( l2_agent_type=self.l2_agent_type, firewall_driver=self.firewall_driver, - dhcp_agent=True) for _ in range(self.num_hosts)] + dhcp_agent=False) for _ in range(self.num_hosts)] env = environment.Environment( environment.EnvironmentDescription( network_type=self.network_type, @@ -246,11 +246,10 @@ class TestSecurityGroupsSameNetwork(BaseSecurityGroupsSameNetworkTest): tenant_uuid, self.safe_client, neutron_port=ports[-1], - use_dhcp=True))) + use_dhcp=False))) self.assertEqual(5, len(vms)) vms[4].block_until_boot() - vms[4].block_until_dhcp_config_done() netcat = net_helpers.NetcatTester(vms[4].namespace, vms[0].namespace, vms[0].ip, 3355, @@ -566,10 +565,9 @@ class TestSecurityGroupsSameNetwork(BaseSecurityGroupsSameNetworkTest): tenant_uuid, self.safe_client, neutron_port=ports[port], - use_dhcp=True)) + use_dhcp=False)) for port, host in enumerate(index_to_host)] map(lambda vm: vm.block_until_boot(), vms) - map(lambda vm: vm.block_until_dhcp_config_done(), vms) return vms, ports, sgs, network, index_to_host