Example #1
0
    def setUp(self):
        super(BaseAPITest, self).setUp()
        self.conf = self.useFixture(oslo_fixture.Config(cfg.CONF))
        self.conf.config(api_handler='simulated_handler')
        self.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.l7policy_repo = repositories.L7PolicyRepository()
        self.l7rule_repo = repositories.L7RuleRepository()
        self.amphora_repo = repositories.AmphoraRepository()
        patcher = mock.patch('octavia.api.handlers.controller_simulator.'
                             'handler.SimulatedControllerHandler')
        self.handler_mock = patcher.start()
        self.check_quota_met_true_mock = mock.patch(
            'octavia.db.repositories.Repositories.check_quota_met',
            return_value=True)
        self.app = self._make_app()
        # For no apparent reason, the controller code for v2 uses a static
        # handler mock (the one generated on the initial run) so we need to
        # retrieve it so we use the "correct" mock instead of the one above
        self.handler_mock_bug_workaround = getattr(
            self.app.app.application.application.application.root,
            'v2.0').handler
        self.project_id = uuidutils.generate_uuid()

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

        self.addCleanup(reset_pecan)
Example #2
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._l7policy_flows = l7policy_flows.L7PolicyFlows()
        self._l7rule_flows = l7rule_flows.L7RuleFlows()

        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()
        self._l7policy_repo = repo.L7PolicyRepository()
        self._l7rule_repo = repo.L7RuleRepository()

        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)

        super(ControllerWorker, self).__init__()
Example #3
0
    def __init__(self):
        LOG.info('Health Manager starting.')
        self.seq = 0
        self.amp_repo = repo.AmphoraRepository()
        self.listener_repo = repo.ListenerRepository()
        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)
        self.bigips = [bigip for bigip in self.initialize_bigips()]
        # Cache reachability of every bigip
        self.bigip_status = {bigip.hostname: False for bigip in self.bigips}
        self._active_bigip = None
        self._last_failover_check = 0
        self._last_cleanup_check = 0

        # Create RPC Client
        topic = cfg.CONF.oslo_messaging.topic
        self.target = messaging.Target(
            namespace=o_const.RPC_NAMESPACE_CONTROLLER_AGENT,
            topic=topic,
            version="1.0",
            fanout=False)
        self.client = rpc.get_client(self.target)

        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)
Example #4
0
    def setUp(self):
        super(BaseAPITest, self).setUp()
        self.conf = self.useFixture(oslo_fixture.Config(cfg.CONF))
        self.conf.config(group='api_settings', api_handler='simulated_handler')
        self.conf.config(group="controller_worker",
                         network_driver='network_noop_driver')
        self.conf.config(group='api_settings', auth_strategy=constants.NOAUTH)
        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()
        patcher = mock.patch('octavia.api.handlers.controller_simulator.'
                             'handler.SimulatedControllerHandler')
        self.handler_mock = patcher.start()
        self.app = self._make_app()
        self.project_id = uuidutils.generate_uuid()

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

        self.addCleanup(reset_pecan)
Example #5
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.',
                             '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()
        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)
Example #6
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')
        conf.config(auth_strategy='noauth')
        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.check_quota_met_true_mock = mock.patch(
            'octavia.db.repositories.Repositories.check_quota_met',
            return_value=True)
        self.app = self._make_app()
        self.project_id = uuidutils.generate_uuid()

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

        self.addCleanup(reset_pecan)
Example #7
0
 def __init__(self, exit_event):
     self.cw = cw.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
Example #8
0
 def __init__(self, **kwargs):
     super(BaseComputeTask, self).__init__(**kwargs)
     self.compute = stevedore_driver.DriverManager(
         namespace='octavia.compute.drivers',
         name=CONF.controller_worker.compute_driver,
         invoke_on_load=True).driver
     self.loadbalancer_repo = repo.LoadBalancerRepository()
     self.rate_limit = amphora_rate_limit.AmphoraBuildRateLimit()
Example #9
0
 def __init__(self, **kwargs):
     self.repos = repo.Repositories()
     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()
     super(BaseDatabaseTask, self).__init__(**kwargs)
Example #10
0
 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()
Example #11
0
 def __init__(self):
     super().__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()
 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 = repo.LoadBalancerRepository()
     self.vip_repo = repo.VipRepository()
     self.listener_repo = repo.ListenerRepository()
     super(BaseDatabaseTask, self).__init__(**kwargs)
Example #13
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)
Example #14
0
    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))
Example #15
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.lb = repo.LoadBalancerRepository()

        self.dbclean.amp_repo = self.amp_repo
        self.dbclean.amp_health_repo = self.amp_health_repo
        self.CONF = cfg.CONF
Example #16
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
Example #17
0
 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()
Example #18
0
    def __init__(self, **kwargs):
        self.loadbalancer_repo = repo.LoadBalancerRepository()
        self.listener_repo = repo.ListenerRepository()
        self.pool_repo = repo.PoolRepository()
        self.health_mon_repo = repo.HealthMonitorRepository()
        self.member_repo = repo.MemberRepository()
        self.l7policy_repo = repo.L7PolicyRepository()
        self.l7rule_repo = repo.L7RuleRepository()
        self.listener_stats_repo = repo.ListenerStatisticsRepository()

        self.db_session = db_apis.get_session()
        super(DriverLibrary, self).__init__(**kwargs)
Example #19
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()
Example #20
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__()
Example #21
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()
        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)
Example #22
0
 def __init__(self):
     self._lb_repo = repo.LoadBalancerRepository()
     self._listener_repo = repo.ListenerRepository()
     self._pool_repo = repo.PoolRepository()
     self._member_repo = a10repo.MemberRepository()
     self._health_mon_repo = repo.HealthMonitorRepository()
     self._l7policy_repo = repo.L7PolicyRepository()
     self._l7rule_repo = repo.L7RuleRepository()
     self._lb_flows = a10_load_balancer_flows.LoadBalancerFlows()
     self._listener_flows = a10_listener_flows.ListenerFlows()
     self._pool_flows = a10_pool_flows.PoolFlows()
     self._member_flows = a10_member_flows.MemberFlows()
     self._health_monitor_flows = a10_health_monitor_flows.HealthMonitorFlows()
     self._l7policy_flows = a10_l7policy_flows.L7PolicyFlows()
     self._l7rule_flows = a10_l7rule_flows.L7RuleFlows()
     self._vthunder_flows = vthunder_flows.VThunderFlows()
     self._vthunder_repo = a10repo.VThunderRepository()
     self._exclude_result_logging_tasks = ()
     super(A10ControllerWorker, self).__init__()
Example #23
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)
Example #25
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._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__()
Example #26
0
 def __init__(self):
     super().__init__()
     self.listener_stats_repo = repo.ListenerStatisticsRepository()
     self.repo_amphora = repo.AmphoraRepository()
     self.repo_loadbalancer = repo.LoadBalancerRepository()
Example #27
0
 def __init__(self):
     self.amp_repo = repo.AmphoraRepository()
     self.amp_health_repo = repo.AmphoraHealthRepository()
     self.lb_repo = repo.LoadBalancerRepository()
Example #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()
Example #29
0
 def __init__(self):
     self.amp_flows = amphora_flows.AmphoraFlows()
     self.listener_flows = listener_flows.ListenerFlows()
     self.pool_flows = pool_flows.PoolFlows()
     self.member_flows = member_flows.MemberFlows()
     self.lb_repo = repo.LoadBalancerRepository()
Example #30
0
 def __init__(self):
     self.lb_repo = repo.LoadBalancerRepository()