Exemple #1
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__()
Exemple #2
0
def process_get(get_data):
    session = db_api.get_session()

    if get_data[constants.OBJECT] == lib_consts.LOADBALANCERS:
        lb_repo = repositories.LoadBalancerRepository()
        db_lb = lb_repo.get(session, id=get_data[lib_consts.ID],
                            show_deleted=False)
        if db_lb:
            provider_lb = (
                driver_utils.db_loadbalancer_to_provider_loadbalancer(db_lb))
            return provider_lb.to_dict(recurse=True, render_unsets=True)
    elif get_data[constants.OBJECT] == lib_consts.LISTENERS:
        listener_repo = repositories.ListenerRepository()
        db_listener = listener_repo.get(
            session, id=get_data[lib_consts.ID], show_deleted=False)
        if db_listener:
            provider_listener = (
                driver_utils.db_listener_to_provider_listener(db_listener))
            return provider_listener.to_dict(recurse=True, render_unsets=True)
    elif get_data[constants.OBJECT] == lib_consts.POOLS:
        pool_repo = repositories.PoolRepository()
        db_pool = pool_repo.get(session, id=get_data[lib_consts.ID],
                                show_deleted=False)
        if db_pool:
            provider_pool = (
                driver_utils.db_pool_to_provider_pool(db_pool))
            return provider_pool.to_dict(recurse=True, render_unsets=True)
    elif get_data[constants.OBJECT] == lib_consts.MEMBERS:
        member_repo = repositories.MemberRepository()
        db_member = member_repo.get(session, id=get_data[lib_consts.ID],
                                    show_deleted=False)
        if db_member:
            provider_member = (
                driver_utils.db_member_to_provider_member(db_member))
            return provider_member.to_dict(recurse=True, render_unsets=True)
    elif get_data[constants.OBJECT] == lib_consts.HEALTHMONITORS:
        hm_repo = repositories.HealthMonitorRepository()
        db_hm = hm_repo.get(session, id=get_data[lib_consts.ID],
                            show_deleted=False)
        if db_hm:
            provider_hm = (
                driver_utils.db_HM_to_provider_HM(db_hm))
            return provider_hm.to_dict(recurse=True, render_unsets=True)
    elif get_data[constants.OBJECT] == lib_consts.L7POLICIES:
        l7policy_repo = repositories.L7PolicyRepository()
        db_l7policy = l7policy_repo.get(session, id=get_data[lib_consts.ID],
                                        show_deleted=False)
        if db_l7policy:
            provider_l7policy = (
                driver_utils.db_l7policy_to_provider_l7policy(db_l7policy))
            return provider_l7policy.to_dict(recurse=True, render_unsets=True)
    elif get_data[constants.OBJECT] == lib_consts.L7RULES:
        l7rule_repo = repositories.L7RuleRepository()
        db_l7rule = l7rule_repo.get(session, id=get_data[lib_consts.ID],
                                    show_deleted=False)
        if db_l7rule:
            provider_l7rule = (
                driver_utils.db_l7rule_to_provider_l7rule(db_l7rule))
            return provider_l7rule.to_dict(recurse=True, render_unsets=True)
    return {}
Exemple #3
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)
Exemple #4
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)
Exemple #5
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.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)
Exemple #6
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()
     self.pool_repo = repo.PoolRepository()
     super(BaseControllerTask, self).__init__(**kwargs)
Exemple #7
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)
Exemple #8
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()
Exemple #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)
Exemple #10
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 #12
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)
Exemple #13
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()
Exemple #14
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 #15
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)
Exemple #16
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__()
Exemple #17
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):

        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__()