Esempio n. 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__()
Esempio n. 2
0
 def setUp(self):
     super(TestAmphoraFlows, self).setUp()
     self.conf = self.useFixture(oslo_fixture.Config(cfg.CONF))
     self.conf.config(group="controller_worker",
                      amphora_driver='amphora_haproxy_rest_driver')
     self.conf.config(group="nova", enable_anti_affinity=False)
     self.AmpFlow = amphora_flows.AmphoraFlows()
Esempio n. 3
0
    def setUp(self):
        cfg.CONF.set_override('amphora_driver',
                              'amphora_haproxy_ssh_driver',
                              group='controller_worker')
        self.AmpFlow = amphora_flows.AmphoraFlows()
        conf = oslo_fixture.Config(cfg.CONF)
        conf.config(group="keystone_authtoken", auth_version=AUTH_VERSION)

        super(TestAmphoraFlows, self).setUp()
 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.vthunder_flows = vthunder_flows.VThunderFlows()
     self._listener_flows = a10_listener_flows.ListenerFlows()
     self._l7policy_flows = a10_l7policy_flows.L7PolicyFlows()
     self._pool_flows = a10_pool_flows.PoolFlows()
Esempio n. 5
0
    def test_cert_rotate_amphora_flow(self, mock_get_net_driver):
        self.AmpFlow = amphora_flows.AmphoraFlows()

        amp_rotate_flow = self.AmpFlow.cert_rotate_amphora_flow()
        self.assertIsInstance(amp_rotate_flow, flow.Flow)

        self.assertIn(constants.SERVER_PEM, amp_rotate_flow.provides)
        self.assertIn(constants.AMPHORA, amp_rotate_flow.requires)

        self.assertEqual(1, len(amp_rotate_flow.provides))
        self.assertEqual(2, len(amp_rotate_flow.requires))
Esempio n. 6
0
 def setUp(self):
     super(TestAmphoraFlows, self).setUp()
     self.conf = self.useFixture(oslo_fixture.Config(cfg.CONF))
     self.conf.config(group="controller_worker",
                      amphora_driver='amphora_haproxy_rest_driver')
     self.conf.config(group="nova", enable_anti_affinity=False)
     self.AmpFlow = amphora_flows.AmphoraFlows()
     self.amp1 = data_models.Amphora(id=1)
     self.amp2 = data_models.Amphora(id=2)
     self.amp3 = data_models.Amphora(id=3, status=constants.DELETED)
     self.lb = data_models.LoadBalancer(
         id=4, amphorae=[self.amp1, self.amp2, self.amp3])
Esempio n. 7
0
    def test_cert_rotate_amphora_flow(self):
        cfg.CONF.set_override('amphora_driver', 'amphora_haproxy_rest_driver',
                              group='controller_worker')
        self.AmpFlow = amphora_flows.AmphoraFlows()

        amp_rotate_flow = self.AmpFlow.cert_rotate_amphora_flow()
        self.assertIsInstance(amp_rotate_flow, flow.Flow)

        self.assertIn(constants.SERVER_PEM, amp_rotate_flow.provides)
        self.assertIn(constants.AMPHORA, amp_rotate_flow.requires)

        self.assertEqual(1, len(amp_rotate_flow.provides))
        self.assertEqual(2, len(amp_rotate_flow.requires))
Esempio n. 8
0
    def test_get_create_amphora_flow_cert(self, mock_get_net_driver):
        self.AmpFlow = amphora_flows.AmphoraFlows()

        amp_flow = self.AmpFlow.get_create_amphora_flow()

        self.assertIsInstance(amp_flow, flow.Flow)

        self.assertIn(constants.AMPHORA, amp_flow.provides)
        self.assertIn(constants.AMPHORA_ID, amp_flow.provides)
        self.assertIn(constants.COMPUTE_ID, amp_flow.provides)

        self.assertEqual(5, len(amp_flow.provides))
        self.assertEqual(2, len(amp_flow.requires))
Esempio n. 9
0
    def test_get_post_map_lb_subflow(self, mock_get_net_driver):

        self.AmpFlow = amphora_flows.AmphoraFlows()

        amp_flow = self.AmpFlow._get_post_map_lb_subflow(
            'SOMEPREFIX', constants.ROLE_MASTER)

        self.assertIsInstance(amp_flow, flow.Flow)

        self.assertIn(constants.FLAVOR, amp_flow.requires)
        self.assertIn(constants.AMPHORA_ID, amp_flow.requires)
        self.assertIn(constants.AMPHORA, amp_flow.provides)

        self.assertEqual(1, len(amp_flow.provides))
        self.assertEqual(2, len(amp_flow.requires))

        amp_flow = self.AmpFlow._get_post_map_lb_subflow(
            'SOMEPREFIX', constants.ROLE_BACKUP)

        self.assertIsInstance(amp_flow, flow.Flow)

        self.assertIn(constants.FLAVOR, amp_flow.requires)
        self.assertIn(constants.AMPHORA_ID, amp_flow.requires)
        self.assertIn(constants.AMPHORA, amp_flow.provides)

        self.assertEqual(1, len(amp_flow.provides))
        self.assertEqual(2, len(amp_flow.requires))

        amp_flow = self.AmpFlow._get_post_map_lb_subflow(
            'SOMEPREFIX', constants.ROLE_STANDALONE)

        self.assertIsInstance(amp_flow, flow.Flow)

        self.assertIn(constants.FLAVOR, amp_flow.requires)
        self.assertIn(constants.AMPHORA_ID, amp_flow.requires)
        self.assertIn(constants.AMPHORA, amp_flow.provides)

        self.assertEqual(1, len(amp_flow.provides))
        self.assertEqual(2, len(amp_flow.requires))

        amp_flow = self.AmpFlow._get_post_map_lb_subflow(
            'SOMEPREFIX', 'BOGUS_ROLE')

        self.assertIsInstance(amp_flow, flow.Flow)

        self.assertIn(constants.FLAVOR, amp_flow.requires)
        self.assertIn(constants.AMPHORA_ID, amp_flow.requires)
        self.assertIn(constants.AMPHORA, amp_flow.provides)

        self.assertEqual(1, len(amp_flow.provides))
        self.assertEqual(2, len(amp_flow.requires))
Esempio n. 10
0
    def setUp(self):
        super(TestAmphoraFlows, self).setUp()
        old_amp_driver = cfg.CONF.controller_worker.amphora_driver
        cfg.CONF.set_override('amphora_driver',
                              'amphora_haproxy_rest_driver',
                              group='controller_worker')
        cfg.CONF.set_override('enable_anti_affinity', False, group='nova')
        self.AmpFlow = amphora_flows.AmphoraFlows()
        conf = oslo_fixture.Config(cfg.CONF)
        conf.config(group="keystone_authtoken", auth_version=AUTH_VERSION)

        self.addCleanup(cfg.CONF.set_override,
                        'amphora_driver',
                        old_amp_driver,
                        group='controller_worker')
Esempio n. 11
0
    def test_get_create_amphora_flow_cert(self):
        cfg.CONF.set_override('amphora_driver', 'amphora_haproxy_rest_driver',
                              group='controller_worker')
        self.AmpFlow = amphora_flows.AmphoraFlows()

        amp_flow = self.AmpFlow.get_create_amphora_flow()

        self.assertIsInstance(amp_flow, flow.Flow)

        self.assertIn(constants.AMPHORA, amp_flow.provides)
        self.assertIn(constants.AMPHORA_ID, amp_flow.provides)
        self.assertIn(constants.COMPUTE_ID, amp_flow.provides)

        self.assertEqual(5, len(amp_flow.provides))
        self.assertEqual(0, len(amp_flow.requires))
Esempio n. 12
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__()
Esempio n. 13
0
    def test_get_cert_bogus_create_amphora_for_lb_flow(self):
        self.AmpFlow = amphora_flows.AmphoraFlows()

        amp_flow = self.AmpFlow._get_create_amp_for_lb_subflow(
            'SOMEPREFIX', 'BOGUS_ROLE')

        self.assertIsInstance(amp_flow, flow.Flow)

        self.assertIn(constants.LOADBALANCER_ID, amp_flow.requires)

        self.assertIn(constants.AMPHORA, amp_flow.provides)
        self.assertIn(constants.AMPHORA_ID, amp_flow.provides)
        self.assertIn(constants.COMPUTE_ID, amp_flow.provides)
        self.assertIn(constants.COMPUTE_OBJ, amp_flow.provides)
        self.assertIn(constants.SERVER_PEM, amp_flow.provides)

        self.assertEqual(5, len(amp_flow.provides))
        self.assertEqual(1, len(amp_flow.requires))
Esempio n. 14
0
    def test_get_cert_backup_rest_anti_affinity_create_amphora_for_lb_flow(
            self, mock_get_net_driver):
        self.conf.config(group="nova", enable_anti_affinity=True)

        self.AmpFlow = amphora_flows.AmphoraFlows()
        amp_flow = self.AmpFlow._get_create_amp_for_lb_subflow(
            'SOMEPREFIX', constants.ROLE_BACKUP)

        self.assertIsInstance(amp_flow, flow.Flow)
        self.assertIn(constants.AMPHORA_ID, amp_flow.provides)
        self.assertIn(constants.SERVER_GROUP_ID, amp_flow.requires)
        self.assertIn(constants.COMPUTE_ID, amp_flow.provides)
        self.assertIn(constants.COMPUTE_OBJ, amp_flow.provides)
        self.assertIn(constants.SERVER_PEM, amp_flow.provides)

        self.assertEqual(5, len(amp_flow.provides))
        self.assertEqual(4, len(amp_flow.requires))
        self.conf.config(group="nova", enable_anti_affinity=False)
Esempio n. 15
0
    def test_get_cert_create_amphora_for_lb_flow(self, mock_get_net_driver):

        self.AmpFlow = amphora_flows.AmphoraFlows()

        amp_flow = self.AmpFlow._get_create_amp_for_lb_subflow(
            'SOMEPREFIX', constants.ROLE_STANDALONE)

        self.assertIsInstance(amp_flow, flow.Flow)

        self.assertIn(constants.LOADBALANCER_ID, amp_flow.requires)

        self.assertIn(constants.AMPHORA, amp_flow.provides)
        self.assertIn(constants.AMPHORA_ID, amp_flow.provides)
        self.assertIn(constants.COMPUTE_ID, amp_flow.provides)
        self.assertIn(constants.COMPUTE_OBJ, amp_flow.provides)
        self.assertIn(constants.SERVER_PEM, amp_flow.provides)

        self.assertEqual(5, len(amp_flow.provides))
        self.assertEqual(3, len(amp_flow.requires))
Esempio n. 16
0
    def test_get_cert_create_amphora_for_lb_flow(self):
        cfg.CONF.set_override('amphora_driver',
                              'amphora_haproxy_rest_driver',
                              group='controller_worker')
        self.AmpFlow = amphora_flows.AmphoraFlows()
        amp_flow = self.AmpFlow.get_create_amphora_for_lb_flow()

        self.assertIsInstance(amp_flow, flow.Flow)

        self.assertIn(constants.LOADBALANCER_ID, amp_flow.requires)
        self.assertIn(constants.AMPHORA, amp_flow.provides)
        self.assertIn(constants.LOADBALANCER, amp_flow.provides)
        self.assertIn(constants.VIP, amp_flow.provides)
        self.assertIn(constants.AMPS_DATA, amp_flow.provides)
        self.assertIn(constants.AMPHORA_ID, amp_flow.provides)
        self.assertIn(constants.COMPUTE_ID, amp_flow.provides)
        self.assertIn(constants.COMPUTE_OBJ, amp_flow.provides)

        self.assertEqual(9, len(amp_flow.provides))
        self.assertEqual(1, len(amp_flow.requires))
Esempio n. 17
0
    def test_get_cert_bogus_create_amphora_for_lb_flow(self):
        cfg.CONF.set_override('amphora_driver', 'amphora_haproxy_rest_driver',
                              group='controller_worker')
        self.AmpFlow = amphora_flows.AmphoraFlows()

        amp_flow = self.AmpFlow._get_create_amp_for_lb_subflow(
            'SOMEPREFIX', 'BOGUS_ROLE')

        self.assertIsInstance(amp_flow, flow.Flow)

        self.assertIn(constants.LOADBALANCER_ID, amp_flow.requires)

        self.assertIn(constants.AMPHORA, amp_flow.provides)
        self.assertIn(constants.AMPHORA_ID, amp_flow.provides)
        self.assertIn(constants.COMPUTE_ID, amp_flow.provides)
        self.assertIn(constants.COMPUTE_OBJ, amp_flow.provides)
        self.assertIn(constants.SERVER_PEM, amp_flow.provides)

        self.assertEqual(5, len(amp_flow.provides))
        self.assertEqual(1, len(amp_flow.requires))
Esempio n. 18
0
    def test_get_cert_backup_rest_anti_affinity_create_amphora_for_lb_flow(
            self):
        cfg.CONF.set_override('amphora_driver', 'amphora_haproxy_rest_driver',
                              group='controller_worker')
        cfg.CONF.set_override('enable_anti_affinity', True,
                              group='nova')

        self.AmpFlow = amphora_flows.AmphoraFlows()
        amp_flow = self.AmpFlow._get_create_amp_for_lb_subflow(
            'SOMEPREFIX', constants.ROLE_BACKUP)

        self.assertIsInstance(amp_flow, flow.Flow)
        self.assertIn(constants.AMPHORA_ID, amp_flow.provides)
        self.assertIn(constants.SERVER_GROUP_ID, amp_flow.requires)
        self.assertIn(constants.COMPUTE_ID, amp_flow.provides)
        self.assertIn(constants.COMPUTE_OBJ, amp_flow.provides)
        self.assertIn(constants.SERVER_PEM, amp_flow.provides)

        self.assertEqual(5, len(amp_flow.provides))
        self.assertEqual(2, len(amp_flow.requires))
Esempio n. 19
0
 def __init__(self):
     self.amp_flows = amphora_flows.AmphoraFlows()
Esempio n. 20
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()