def __init__(self, **kwargs):
     super(BaseAmphoraTask, self).__init__(**kwargs)
     self.amphora_driver = stevedore_driver.DriverManager(
         namespace='octavia.amphora.drivers',
         name=CONF.controller_worker.amphora_driver,
         invoke_on_load=True).driver
     self.amphora_repo = repo.AmphoraRepository()
     self.listener_repo = repo.ListenerRepository()
     self.loadbalancer_repo = repo.LoadBalancerRepository()
Exemple #2
0
 def __init__(self):
     super(UpdateHealthDb, self).__init__()
     # first setup repo for amphora, listener,member(nodes),pool repo
     self.amphora_repo = repo.AmphoraRepository()
     self.amphora_health_repo = repo.AmphoraHealthRepository()
     self.listener_repo = repo.ListenerRepository()
     self.loadbalancer_repo = repo.LoadBalancerRepository()
     self.member_repo = repo.MemberRepository()
     self.pool_repo = repo.PoolRepository()
Exemple #3
0
    def setUp(self):
        super(TestDatabaseCleanup, self).setUp()
        self.dbclean = house_keeping.DatabaseCleanup()
        self.amp_health_repo = mock.MagicMock()
        self.amp_repo = mock.MagicMock()
        self.amp = repo.AmphoraRepository()

        self.dbclean.amp_repo = self.amp_repo
        self.dbclean.amp_health_repo = self.amp_health_repo
        self.CONF = cfg.CONF
Exemple #4
0
 def __init__(self):
     self.amp_repo = repo.AmphoraRepository()
     self.spares_repo = repo.SparesPoolRepository()
     self.az_repo = repo.AvailabilityZoneRepository()
     if CONF.api_settings.default_provider_driver == constants.AMPHORAV2:
         self.cw = cw2.ControllerWorker()
         self.check_booting_amphora = True
     else:
         self.cw = cw1.ControllerWorker()
         self.check_booting_amphora = False
 def __init__(self, **kwargs):
     self.repos = repo.Repositories()
     self.vthunder_repo = a10_repo.VThunderRepository()
     self.vrid_repo = a10_repo.VRIDRepository()
     self.amphora_repo = repo.AmphoraRepository()
     self.member_repo = a10_repo.MemberRepository()
     self.loadbalancer_repo = a10_repo.LoadBalancerRepository()
     self.vip_repo = repo.VipRepository()
     self.listener_repo = repo.ListenerRepository()
     super(BaseDatabaseTask, self).__init__(**kwargs)
Exemple #6
0
 def __init__(self, exit_event):
     if CONF.api_settings.default_provider_driver == constants.AMPHORAV2:
         self.cw = cw2.ControllerWorker()
     else:
         self.cw = cw1.ControllerWorker()
     self.threads = CONF.health_manager.failover_threads
     self.executor = futures.ThreadPoolExecutor(max_workers=self.threads)
     self.amp_repo = repo.AmphoraRepository()
     self.amp_health_repo = repo.AmphoraHealthRepository()
     self.lb_repo = repo.LoadBalancerRepository()
     self.dead = exit_event
    def setUp(self):
        super().setUp()
        self.dbclean = house_keeping.DatabaseCleanup()
        self.amp_health_repo = mock.MagicMock()
        self.amp_repo = mock.MagicMock()
        self.amp = repo.AmphoraRepository()
        self.lb = repo.LoadBalancerRepository()

        self.dbclean.amp_repo = self.amp_repo
        self.dbclean.amp_health_repo = self.amp_health_repo
        self.CONF = self.useFixture(oslo_fixture.Config(cfg.CONF))
Exemple #8
0
 def __init__(self, **kwargs):
     self.amphora_repo = repo.AmphoraRepository()
     self.health_mon_repo = repo.HealthMonitorRepository()
     self.listener_repo = repo.ListenerRepository()
     self.loadbalancer_repo = repo.LoadBalancerRepository()
     self.member_repo = repo.MemberRepository()
     self.pool_repo = repo.PoolRepository()
     self.amp_health_repo = repo.AmphoraHealthRepository()
     self.l7policy_repo = repo.L7PolicyRepository()
     self.l7rule_repo = repo.L7RuleRepository()
     super(TaskUtils, self).__init__(**kwargs)
 def setUp(self):
     super(BaseRepositoryTest, self).setUp()
     self.pool_repo = repo.PoolRepository()
     self.member_repo = repo.MemberRepository()
     self.lb_repo = repo.LoadBalancerRepository()
     self.vip_repo = repo.VipRepository()
     self.listener_repo = repo.ListenerRepository()
     self.listener_stats_repo = repo.ListenerStatisticsRepository()
     self.sp_repo = repo.SessionPersistenceRepository()
     self.hm_repo = repo.HealthMonitorRepository()
     self.sni_repo = repo.SNIRepository()
     self.amphora_repo = repo.AmphoraRepository()
Exemple #10
0
 def __init__(self):
     super(UpdateHealthDb, self).__init__()
     # first setup repo for amphora, listener,member(nodes),pool repo
     self.event_streamer = stevedore_driver.DriverManager(
         namespace='octavia.controller.queues',
         name=CONF.health_manager.event_streamer_driver,
         invoke_on_load=True).driver
     self.amphora_repo = repo.AmphoraRepository()
     self.amphora_health_repo = repo.AmphoraHealthRepository()
     self.listener_repo = repo.ListenerRepository()
     self.loadbalancer_repo = repo.LoadBalancerRepository()
     self.member_repo = repo.MemberRepository()
     self.pool_repo = repo.PoolRepository()
 def __init__(self, **kwargs):
     self.repos = repo.Repositories()
     self.vthunder_repo = a10_repo.VThunderRepository()
     self.vrid_repo = a10_repo.VRIDRepository()
     self.amphora_repo = repo.AmphoraRepository()
     self.member_repo = a10_repo.MemberRepository()
     self.loadbalancer_repo = a10_repo.LoadBalancerRepository()
     self.vip_repo = repo.VipRepository()
     self.listener_repo = repo.ListenerRepository()
     self.flavor_repo = repo.FlavorRepository()
     self.flavor_profile_repo = repo.FlavorProfileRepository()
     self.nat_pool_repo = a10_repo.NatPoolRepository()
     self.vrrp_set_repo = a10_repo.VrrpSetRepository()
     super(BaseDatabaseTask, self).__init__(**kwargs)
Exemple #12
0
    def rotate(self):
        """Check the amphora db table for expiring auth certs."""
        amp_repo = repo.AmphoraRepository()

        with futures.ThreadPoolExecutor(max_workers=self.threads) as executor:
            session = db_api.get_session()
            rotation_count = 0
            while True:
                amp = amp_repo.get_cert_expiring_amphora(session)
                if not amp:
                    break
                rotation_count += 1
                LOG.debug("Cert expired amphora's id is: %s", amp.id)
                executor.submit(self.cw.amphora_cert_rotation, amp.id)
            if rotation_count > 0:
                LOG.info("Rotated certificates for %s amphora", rotation_count)
Exemple #13
0
    def __init__(self):

        self._amphora_flows = amphora_flows.AmphoraFlows()
        self._health_monitor_flows = health_monitor_flows.HealthMonitorFlows()
        self._lb_flows = load_balancer_flows.LoadBalancerFlows()
        self._listener_flows = listener_flows.ListenerFlows()
        self._member_flows = member_flows.MemberFlows()
        self._pool_flows = pool_flows.PoolFlows()

        self._amphora_repo = repo.AmphoraRepository()
        self._health_mon_repo = repo.HealthMonitorRepository()
        self._lb_repo = repo.LoadBalancerRepository()
        self._listener_repo = repo.ListenerRepository()
        self._member_repo = repo.MemberRepository()
        self._pool_repo = repo.PoolRepository()

        super(ControllerWorker, self).__init__()
Exemple #14
0
    def setUp(self):
        super(BaseAPITest, self).setUp()
        cfg.CONF.set_override('api_handler', 'simulated_handler')
        self.lb_repo = repositories.LoadBalancerRepository()
        self.listener_repo = repositories.ListenerRepository()
        self.listener_stats_repo = repositories.ListenerStatisticsRepository()
        self.pool_repo = repositories.PoolRepository()
        self.member_repo = repositories.MemberRepository()
        self.amphora_repo = repositories.AmphoraRepository()
        patcher = mock.patch('octavia.api.v1.handlers.controller_simulator.'
                             'handler.SimulatedControllerHandler')
        self.handler_mock = patcher.start()
        self.app = self._make_app()

        def reset_pecan():
            patcher.stop()
            pecan.set_config({}, overwrite=True)

        self.addCleanup(reset_pecan)
Exemple #15
0
    def __init__(self):

        self._amphora_repo = repo.AmphoraRepository()
        self._amphora_health_repo = repo.AmphoraHealthRepository()
        self._health_mon_repo = repo.HealthMonitorRepository()
        self._lb_repo = repo.LoadBalancerRepository()
        self._listener_repo = repo.ListenerRepository()
        self._member_repo = repo.MemberRepository()
        self._pool_repo = repo.PoolRepository()
        self._l7policy_repo = repo.L7PolicyRepository()
        self._l7rule_repo = repo.L7RuleRepository()
        self._flavor_repo = repo.FlavorRepository()
        self._az_repo = repo.AvailabilityZoneRepository()

        persistence = tsk_driver.MysqlPersistenceDriver()

        self.jobboard_driver = stevedore_driver.DriverManager(
            namespace='octavia.worker.jobboard_driver',
            name=CONF.task_flow.jobboard_backend_driver,
            invoke_args=(persistence, ),
            invoke_on_load=True).driver
    def __init__(self):
        super(StatusManager,
              self).__init__(bigip_urls=CONF.f5_agent.bigip_urls,
                             enable_verify=CONF.f5_agent.bigip_verify,
                             enable_token=CONF.f5_agent.bigip_token)
        self.amphora_id = None
        self.seq = 0
        LOG.info('Health Manager Sender starting.')
        self.amp_repo = repo.AmphoraRepository()
        self.amp_health_repo = repo.AmphoraHealthRepository()
        self.lb_repo = repo.LoadBalancerRepository()
        self.health_executor = futurist.ThreadPoolExecutor(
            max_workers=CONF.health_manager.health_update_threads)
        self.stats_executor = futurist.ThreadPoolExecutor(
            max_workers=CONF.health_manager.stats_update_threads)

        if cfg.CONF.f5_agent.prometheus:
            prometheus_port = CONF.f5_agent.prometheus_port
            LOG.info('Starting Prometheus HTTP server on port {}'.format(
                prometheus_port))
            prometheus.start_http_server(prometheus_port)
Exemple #17
0
    def __init__(self):
        self._repositories = repo.Repositories()
        self._loadbalancer_repo = f5_repos.LoadBalancerRepository()
        self._amphora_repo = repo.AmphoraRepository()
        self._health_mon_repo = repo.HealthMonitorRepository()
        self._listener_repo = f5_repos.ListenerRepository()
        self._member_repo = repo.MemberRepository()
        self._pool_repo = f5_repos.PoolRepository()
        self._l7policy_repo = f5_repos.L7PolicyRepository()
        self._l7rule_repo = repo.L7RuleRepository()
        self._vip_repo = repo.VipRepository()
        self._quota_repo = repo.QuotasRepository()

        self.status = status_manager.StatusManager()
        self.sync = sync_manager.SyncManager(self.status,
                                             self._loadbalancer_repo)
        self.network_driver = driver_utils.get_network_driver()
        self.queue = SetQueue()
        worker = periodics.PeriodicWorker([
            (self.pending_sync, None, None),
            (self.full_sync_reappearing_devices, None, None),
            (self.cleanup_orphaned_tenants, None, None)
        ])
        t = threading.Thread(target=worker.start)
        t.daemon = True
        t.start()

        LOG.info("Starting as3worker")
        as3worker = threading.Thread(target=self.as3worker)
        as3worker.setDaemon(True)
        as3worker.start()

        if cfg.CONF.f5_agent.prometheus:
            prometheus_port = CONF.f5_agent.prometheus_port
            LOG.info('Starting Prometheus HTTP server on port {}'.format(
                prometheus_port))
            prometheus.start_http_server(prometheus_port)

        super(ControllerWorker, self).__init__()
Exemple #18
0
    def setUp(self):
        super(BaseAPITest, self).setUp()
        conf = self.useFixture(oslo_fixture.Config(cfg.CONF))
        conf.config(api_handler='simulated_handler')
        conf.config(group="controller_worker",
                    network_driver='network_noop_driver')
        self.lb_repo = repositories.LoadBalancerRepository()
        self.listener_repo = repositories.ListenerRepository()
        self.listener_stats_repo = repositories.ListenerStatisticsRepository()
        self.pool_repo = repositories.PoolRepository()
        self.member_repo = repositories.MemberRepository()
        self.amphora_repo = repositories.AmphoraRepository()
        patcher = mock.patch('octavia.api.handlers.controller_simulator.'
                             'handler.SimulatedControllerHandler')
        self.handler_mock = patcher.start()
        self.app = self._make_app()

        def reset_pecan():
            patcher.stop()
            pecan.set_config({}, overwrite=True)

        self.addCleanup(reset_pecan)
    def __init__(self):

        self._amphora_flows = amphora_flows.AmphoraFlows()
        self._health_monitor_flows = health_monitor_flows.HealthMonitorFlows()
        self._lb_flows = load_balancer_flows.LoadBalancerFlows()
        self._listener_flows = listener_flows.ListenerFlows()
        self._member_flows = member_flows.MemberFlows()
        self._pool_flows = pool_flows.PoolFlows()
        self._l7policy_flows = l7policy_flows.L7PolicyFlows()
        self._l7rule_flows = l7rule_flows.L7RuleFlows()
        self._distributor_flows = distributor_flows.DistributorFlows()

        self._amphora_repo = repo.AmphoraRepository()
        self._amphora_health_repo = repo.AmphoraHealthRepository()
        self._health_mon_repo = repo.HealthMonitorRepository()
        self._lb_repo = repo.LoadBalancerRepository()
        self._listener_repo = repo.ListenerRepository()
        self._member_repo = repo.MemberRepository()
        self._pool_repo = repo.PoolRepository()
        self._l7policy_repo = repo.L7PolicyRepository()
        self._l7rule_repo = repo.L7RuleRepository()
        self._flavor_repo = repo.FlavorRepository()
        self._distributor_repo = repo.DistributorRepository()

        self._exclude_result_logging_tasks = (
            constants.ROLE_STANDALONE + '-' +
            constants.CREATE_AMP_FOR_LB_SUBFLOW + '-' +
            constants.GENERATE_SERVER_PEM,
            constants.ROLE_BACKUP + '-' + constants.CREATE_AMP_FOR_LB_SUBFLOW +
            '-' + constants.GENERATE_SERVER_PEM, constants.ROLE_MASTER + '-' +
            constants.CREATE_AMP_FOR_LB_SUBFLOW + '-' +
            constants.GENERATE_SERVER_PEM, constants.GENERATE_SERVER_PEM_TASK,
            constants.FAILOVER_AMPHORA_FLOW + '-' +
            constants.CREATE_AMP_FOR_LB_SUBFLOW + '-' +
            constants.GENERATE_SERVER_PEM,
            constants.CREATE_AMP_FOR_LB_SUBFLOW + '-' +
            constants.UPDATE_CERT_EXPIRATION)

        super(ControllerWorker, self).__init__()
Exemple #20
0
    def setUp(self):
        super(BaseAPITest, self).setUp()
        self.conf = self.useFixture(oslo_fixture.Config(cfg.CONF))
        self.conf.config(group="controller_worker",
                         network_driver='network_noop_driver')
        self.conf.config(group='api_settings', auth_strategy=constants.NOAUTH)
        self.conf.config(group='api_settings',
                         default_provider_driver='noop_driver')
        # We still need to test with the "octavia" alias
        self.conf.config(group='api_settings',
                         enabled_provider_drivers={
                             'amphora': 'Amp driver.',
                             'noop_driver': 'NoOp driver.',
                             'noop_driver-alt': 'NoOp driver alt alisas.',
                             'octavia': 'Octavia driver.'
                         })
        self.lb_repo = repositories.LoadBalancerRepository()
        self.listener_repo = repositories.ListenerRepository()
        self.listener_stats_repo = repositories.ListenerStatisticsRepository()
        self.pool_repo = repositories.PoolRepository()
        self.member_repo = repositories.MemberRepository()
        self.l7policy_repo = repositories.L7PolicyRepository()
        self.l7rule_repo = repositories.L7RuleRepository()
        self.health_monitor_repo = repositories.HealthMonitorRepository()
        self.amphora_repo = repositories.AmphoraRepository()
        self.flavor_repo = repositories.FlavorRepository()
        self.flavor_profile_repo = repositories.FlavorProfileRepository()
        self.distributor_repo = repositories.DistributorRepository()
        patcher2 = mock.patch('octavia.certificates.manager.barbican.'
                              'BarbicanCertManager')
        self.cert_manager_mock = patcher2.start()
        self.app = self._make_app()
        self.project_id = uuidutils.generate_uuid()

        def reset_pecan():
            pecan.set_config({}, overwrite=True)

        self.addCleanup(reset_pecan)
    def __init__(self):

        self._amphora_flows = amphora_flows.AmphoraFlows()
        self._health_monitor_flows = health_monitor_flows.HealthMonitorFlows()
        self._lb_flows = load_balancer_flows.LoadBalancerFlows()
        self._listener_flows = listener_flows.ListenerFlows()
        self._member_flows = member_flows.MemberFlows()
        self._pool_flows = pool_flows.PoolFlows()
        self._l7policy_flows = l7policy_flows.L7PolicyFlows()
        self._l7rule_flows = l7rule_flows.L7RuleFlows()

        self._amphora_repo = repo.AmphoraRepository()
        self._amphora_health_repo = repo.AmphoraHealthRepository()
        self._health_mon_repo = repo.HealthMonitorRepository()
        self._lb_repo = repo.LoadBalancerRepository()
        self._listener_repo = repo.ListenerRepository()
        self._member_repo = repo.MemberRepository()
        self._pool_repo = repo.PoolRepository()
        self._l7policy_repo = repo.L7PolicyRepository()
        self._l7rule_repo = repo.L7RuleRepository()
        self._flavor_repo = repo.FlavorRepository()
        self._az_repo = repo.AvailabilityZoneRepository()

        super(ControllerWorker, self).__init__()
Exemple #22
0
 def __init__(self):
     self.amp_repo = repo.AmphoraRepository()
     self.cw = cw.ControllerWorker()
Exemple #23
0
 def __init__(self):
     super().__init__()
     self.listener_stats_repo = repo.ListenerStatisticsRepository()
     self.repo_amphora = repo.AmphoraRepository()
     self.repo_loadbalancer = repo.LoadBalancerRepository()
Exemple #24
0
 def __init__(self, **kwargs):
     from octavia.controller.worker import controller_worker
     self.cntrlr_worker = controller_worker.ControllerWorker()
     self.listener_repo = repo.ListenerRepository()
     self.amp_repo = repo.AmphoraRepository()
     super(BaseControllerTask, self).__init__(**kwargs)
 def __init__(self):
     self.amp_repo = repo.AmphoraRepository()
     self.vthunder_repo = a10repo.VThunderRepository()
     self.cw = cw.A10ControllerWorker()
Exemple #26
0
 def __init__(self):
     self.amp_repo = repo.AmphoraRepository()
     self.amp_health_repo = repo.AmphoraHealthRepository()
     self.lb_repo = repo.LoadBalancerRepository()
Exemple #27
0
 def __init__(self):
     self.amp_repo = repo.AmphoraRepository()
     self.amp_health_repo = repo.AmphoraHealthRepository()
Exemple #28
0
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     self._network_driver = None
     self.task_utils = task_utils.TaskUtils()
     self.loadbalancer_repo = repo.LoadBalancerRepository()
     self.amphora_repo = repo.AmphoraRepository()
        lb_amp_dict[amp.load_balancer_id] = amp.id
        mgmt_port = get_vm_mgmt_port(net_driver, amp.compute_id,
                                     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.
Exemple #30
0
 def __init__(self):
     self.amp_repo = repo.AmphoraRepository()
     self.spares_repo = repo.SparesPoolRepository()
     self.az_repo = repo.AvailabilityZoneRepository()
     self.cw = cw.ControllerWorker()