Exemple #1
0
HM = o_data_models.HealthMonitor(id=a10constants, pool=POOL)
MEMBER_1 = o_data_models.Member(id=uuidutils.generate_uuid(),
                                project_id=a10constants.MOCK_PROJECT_ID,
                                subnet_id=a10constants.MOCK_SUBNET_ID,
                                pool=POOL)
MEMBER_2 = o_data_models.Member(id=uuidutils.generate_uuid(),
                                project_id=a10constants.MOCK_PROJECT_ID,
                                subnet_id=a10constants.MOCK_SUBNET_ID_2,
                                pool=POOL)
FLAVOR_PROFILE = o_data_models.FlavorProfile(
    id=a10constants.MOCK_FLAVOR_PROF_ID, flavor_data={})
FLAVOR = o_data_models.Flavor(
    id=a10constants.MOCK_FLAVOR_ID,
    flavor_profile_id=a10constants.MOCK_FLAVOR_PROF_ID)
SUBNET = n_data_models.Subnet(id=uuidutils.generate_uuid())
NAT_POOL = data_models.NATPool(id=uuidutils.generate_uuid(),
                               port_id=a10constants.MOCK_PORT_ID)


class TestA10DatabaseTasks(base.BaseTaskTestCase):
    def setUp(self):
        super(TestA10DatabaseTasks, self).setUp()
        imp.reload(task)
        self.vrid_repo = mock.Mock()
        self.nat_pool_repo = mock.Mock()
        self.conf = self.useFixture(oslo_fixture.Config(cfg.CONF))
        self.conf.register_opts(config_options.A10_GLOBAL_OPTS,
                                group=a10constants.A10_GLOBAL_CONF_SECTION)
        self.conf.register_opts(
            config_options.A10_HARDWARE_THUNDER_OPTS,
            group=a10constants.HARDWARE_THUNDER_CONF_SECTION)
        self.db_session = mock.patch(
from a10_octavia.common import config_options
from a10_octavia.common import data_models
from a10_octavia.controller.worker.tasks import a10_network_tasks
from a10_octavia.tests.common import a10constants
from a10_octavia.tests.unit import base

MEMBER = o_data_models.Member(subnet_id=a10constants.MOCK_SUBNET_ID)
VTHUNDER = data_models.VThunder()
SUBNET = o_net_data_models.Subnet()
PORT = o_net_data_models.Port()
VRID = data_models.VRID()
VRID_VALUE = 0
SUBNET_1 = o_net_data_models.Subnet(id=a10constants.MOCK_SUBNET_ID)
VRID_1 = data_models.VRID(id=1, subnet_id=a10constants.MOCK_SUBNET_ID)
NAT_POOL = data_models.NATPool(port_id=a10constants.MOCK_PORT_ID)
NAT_FLAVOR = {
    "pool_name": "p1",
    "start_address": "1.1.1.1",
    "end_address": "1.1.1.2"
}
HW_THUNDER = data_models.HardwareThunder(
    project_id=a10constants.MOCK_PROJECT_ID,
    device_name="rack_thunder_1",
    undercloud=True,
    username="******",
    password="******",
    ip_address="10.10.10.10",
    partition_name="shared")
HW_THUNDER2 = data_models.HardwareThunder(
    project_id=a10constants.MOCK_PROJECT_ID,