'Setup a complete "Neutron stack" - both an internal and an external
network+subnet, and a router connected to both.'

def test_keepalived_multiple_sighups_does_not_forfeit_mastership(self):

    tenant_id = uuidutils.generate_uuid()
    (ext_net, ext_sub) = self._create_external_network_and_subnet(tenant_id)
    router = self.safe_client.create_router(tenant_id, ha=True, external_network=ext_net['id'])
    common_utils.wait_until_true((lambda : (len(self.client.list_l3_agent_hosting_routers(router['id'])['agents']) == 2)), timeout=90)
    common_utils.wait_until_true(functools.partial(self._is_ha_router_active_on_one_agent, router['id']), timeout=90)
    keepalived_state_file = self._get_state_file_for_master_agent(router['id'])
    self.assertIsNotNone(keepalived_state_file)
    network = self.safe_client.create_network(tenant_id)
    self._create_and_attach_subnet(tenant_id, '13.37.0.0/24', network['id'], router['id'])
    host = self.environment.hosts[0]
    vms = [self._boot_fake_vm_in_network(host, tenant_id, network['id'], wait=False) for i in range(10)]
    for vm in vms:
        self.safe_client.create_floatingip(tenant_id, ext_net['id'], vm.ip, vm.neutron_port['id'])
    time_to_stop = (time.time() + ((common_utils.DEFAULT_THROTTLER_VALUE * ha_router.THROTTLER_MULTIPLIER) * 1.3))
    while True:
        if (time.time() > time_to_stop):
            break
        self.assertEqual('master', self._get_keepalived_state(keepalived_state_file))
