def setUp(self):
     super(TestAllowedAddressPairsDriver, self).setUp()
     with mock.patch('octavia.common.clients.neutron_client.Client',
                     autospec=True) as neutron_client:
         with mock.patch('octavia.common.clients.nova_client.Client',
                         autospec=True):
             client = neutron_client(clients.NEUTRON_VERSION)
             client.list_extensions.return_value = {
                 'extensions': [
                     {'alias': allowed_address_pairs.AAP_EXT_ALIAS},
                     {'alias': neutron_base.SEC_GRP_EXT_ALIAS}
                 ]
             }
             self.k_session = mock.patch(
                 'keystoneauth1.session.Session').start()
             self.driver = allowed_address_pairs.AllowedAddressPairsDriver()
                                     amp.lb_network_ip)
        disable_port(net_driver, mgmt_port)

    return lb_amp_dict


if __name__ == '__main__':
    raw_input('First, please stop octavia house_keeping process, then press '
              'any key to continue...')

    service.prepare_service(sys.argv)
    session = db_api.get_session()
    amp_repo = repo.AmphoraRepository()
    amphealth_repo = repo.AmphoraHealthRepository()
    nova_manager = nova_driver.VirtualMachineManager()
    net_driver = allowed_address_pairs.AllowedAddressPairsDriver()

    # Delete all the amp vms in spare pool and corresponding db records.
    amps = get_spare_amphoras(session)
    LOG.debug("Step 1: Clean up %d amphorae vms in spare pool.", len(amps))

    for amp in amps:
        delete_amp(nova_manager, session, amp_repo, amphealth_repo, amp)

    raw_input('Now, please start octavia house_keeping process, then press '
              'any key to continue...')

    # Wait for filling up the spare pool.
    LOG.debug("Step 2: Waiting for spare pool to fill up again...")
    check_spare_pool(amp_repo, session)