def get_loadbalancer_flavor(loadbalancer): flavor_repo = repo.FlavorRepository() flavor_profile_repo = repo.FlavorProfileRepository() flavor = {} flavor_id = loadbalancer.flavor_id if flavor_id: flavor = flavor_repo.get(db_apis.get_session(), id=flavor_id) if flavor and flavor.flavor_profile_id: flavor_profile = flavor_profile_repo.get( db_apis.get_session(), id=flavor.flavor_profile_id) flavor_data = json.loads(flavor_profile.flavor_data) return flavor_data
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() super(BaseDatabaseTask, self).__init__(**kwargs)
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)