Ejemplo n.º 1
0
def convert_to_hardware_thunder_conf(hardware_list):
    """Validate for all vthunder nouns for hardware devices configurations."""
    hardware_dict = {}
    for hardware_device in hardware_list:
        hardware_device = validate_params(hardware_device)
        hardware_device['undercloud'] = True
        if hardware_device.get('interface_vlan_map'):
            hardware_device[
                'device_network_map'] = validate_interface_vlan_map(
                    hardware_device)
            del hardware_device['interface_vlan_map']

        # Add dict entries with project_id as key
        if 'project_id' in hardware_device:
            project_id = hardware_device['project_id']
            if hardware_dict.get(project_id):
                raise cfg.ConfigFileValueError(
                    'Supplied duplicate project_id {} '
                    ' in [hardware_thunder] section'.format(project_id))
            hierarchical_mt = hardware_device.get('hierarchical_multitenancy')
            if hierarchical_mt == "enable":
                hardware_device["partition_name"] = project_id[0:14]
            if hierarchical_mt and hierarchical_mt not in ('enable',
                                                           'disable'):
                raise cfg.ConfigFileValueError(
                    'Option `hierarchical_multitenancy` specified '
                    'under project id {} only accepts "enable" and '
                    '"disable"'.format(project_id))
            vthunder_conf = data_models.HardwareThunder(**hardware_device)
            hardware_dict[project_id] = vthunder_conf

        # Add dict entries with dev_name as key
        device_name = hardware_device['device_name']
        if hardware_dict.get(a10constants.DEVICE_KEY_PREFIX + device_name):
            raise cfg.ConfigFileValueError(
                'Supplied duplicate device_name {} '
                ' in [hardware_thunder] section'.format(device_name))
        vthunder_conf = data_models.HardwareThunder(**hardware_device)
        vthunder_conf.device_name_as_key = True
        hardware_dict[(a10constants.DEVICE_KEY_PREFIX +
                       device_name)] = vthunder_conf

        duplicates = check_duplicate_entries(hardware_dict)
        if duplicates:
            raise cfg.ConfigFileValueError(
                'Duplicates found for the following '
                '\'ip_address:partition_name\' entries: {}'.format(
                    list(duplicates)))
    return hardware_dict
Ejemplo n.º 2
0
def convert_to_hardware_thunder_conf(hardware_list):
    """Validate for all vthunder nouns for hardware devices configurations."""
    hardware_dict = {}
    for hardware_device in hardware_list:
        hardware_device = validate_params(hardware_device)
        if hardware_dict.get(hardware_device['project_id']):
            raise cfg.ConfigFileValueError('Supplied duplicate project_id ' +
                                           hardware_device['project_id'] +
                                           ' in [hardware_thunder] section')
        hardware_device['undercloud'] = True
        if hardware_device.get('interface_vlan_map'):
            hardware_device[
                'device_network_map'] = validate_interface_vlan_map(
                    hardware_device)
            del hardware_device['interface_vlan_map']
        vthunder_conf = data_models.HardwareThunder(**hardware_device)
        hardware_dict[hardware_device['project_id']] = vthunder_conf

    duplicates_list = check_duplicate_entries(hardware_dict)
    if duplicates_list:
        raise cfg.ConfigFileValueError(
            'Duplicates found for the following '
            '\'ip_address:partition_name\' entries: {}'.format(
                list(duplicates_list)))
    return hardware_dict
Ejemplo n.º 3
0
from octavia.common import exceptions as o_exceptions
from octavia.network import data_models as n_data_models
from octavia.tests.common import constants as t_constants

from a10_octavia.common import config_options
from a10_octavia.common import data_models
from a10_octavia.common import utils
from a10_octavia.controller.worker.tasks import a10_database_tasks as task
from a10_octavia.tests.common import a10constants
from a10_octavia.tests.unit import base

VTHUNDER = data_models.VThunder()
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")
LB = o_data_models.LoadBalancer(id=a10constants.MOCK_LOAD_BALANCER_ID,
                                flavor_id=a10constants.MOCK_FLAVOR_ID)
FIXED_IP = n_data_models.FixedIP(ip_address='10.10.10.10')
PORT = n_data_models.Port(id=uuidutils.generate_uuid(), fixed_ips=[FIXED_IP])
VRID = data_models.VRID(id=1,
                        vrid=0,
                        owner=a10constants.MOCK_PROJECT_ID,
                        vrid_port_id=uuidutils.generate_uuid(),
                        vrid_floating_ip='10.0.12.32')
LISTENER = o_data_models.Listener(id=a10constants.MOCK_LISTENER_ID,
                                  load_balancer=LB)
POOL = o_data_models.Pool(id=a10constants.MOCK_POOL_ID, load_balancer=LB)
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,
    device_name="rack_thunder_2",
    undercloud=True,
    username="******",
    password="******",
    ip_address="10.10.10.11",
    partition_name="shared",
    vrid_floating_ip="192.168.8.126")
EXISTING_FIP_SHARED_PARTITION = {
    u'vrid': {
        u'blade-parameters': {
Ejemplo n.º 5
0
RACK_DEVICE_2 = {
    "project_id": "project-2",
    "ip_address": "11.0.0.1",
    "device_name": "rack_thunder_2",
    "username": "******",
    "password": "******",
    'partition_name': 'def-sample'
}

VTHUNDER_1 = data_models.HardwareThunder(
    project_id="project-1",
    device_name="rack_thunder_1",
    undercloud=True,
    username="******",
    password="******",
    ip_address="10.0.0.1",
    partition_name="shared",
    device_network_map='"device_1":{"ethernet_interfaces":'
    '[{"interface_num": "5", "vlan_map": ['
    '{"vlan_id": 11, "use_dhcp": "True"},'
    '{"vlan_id": 12, "ve_ip": ".10"}]}]}}')
VTHUNDER_2 = data_models.HardwareThunder(project_id="project-2",
                                         device_name="rack_thunder_2",
                                         undercloud=True,
                                         username="******",
                                         password="******",
                                         ip_address="11.0.0.1",
                                         partition_name="def-sample")

RESULT_RACK_DEVICE_LIST = {'project-1': VTHUNDER_1, 'project-2': VTHUNDER_2}
Ejemplo n.º 6
0
    'device_name': 'rack_thunder_3',
    'username': '******',
    'password': '******'}

HARDWARE_INFO_WITH_HMT_ENABLED = [{
    'project_id': a10constants.MOCK_CHILD_PROJECT_ID,
    'ip_address': '13.13.13.13',
    'device_name': 'rack_thunder_3',
    'username': '******',
    'password': '******',
    'hierarchical_multitenancy': 'enable',
    'partition_name': 'shared'
}]

VTHUNDER_1 = data_models.HardwareThunder(project_id="project-1", device_name="rack_thunder_1",
                                         undercloud=True, username="******", password="******",
                                         ip_address="10.10.10.10", partition_name="shared")
VTHUNDER_1_DEV = data_models.HardwareThunder(project_id="project-1", device_name="rack_thunder_1",
                                             undercloud=True, username="******", password="******",
                                             ip_address="10.10.10.10", partition_name="shared",
                                             device_name_as_key=True)
VTHUNDER_2 = data_models.HardwareThunder(project_id="project-2", device_name="rack_thunder_2",
                                         undercloud=True, username="******", password="******",
                                         ip_address="12.12.12.12", partition_name="def-sample")
VTHUNDER_2_DEV = data_models.HardwareThunder(project_id="project-2", device_name="rack_thunder_2",
                                             undercloud=True, username="******", password="******",
                                             ip_address="12.12.12.12", partition_name="def-sample",
                                             device_name_as_key=True)
VTHUNDER_3 = data_models.HardwareThunder(project_id=a10constants.MOCK_CHILD_PROJECT_ID,
                                         device_name="rack_thunder_3",
                                         undercloud=True, username="******", password="******",
Ejemplo n.º 7
0
            "virtual-wire": 0,
            "l3-vlan-fwd-disable": 0
        }],
        "a10-url":
        "/axapi/v3/interface",
        "common": {
            "uuid": "6d4f4224-8beb-11eb-957b-fa163e54fddf",
            "a10-url": "/axapi/v3/interface/common"
        }
    }
}

FLAVOR_DEV1 = a10_data_models.HardwareThunder(project_id="project-1",
                                              device_name="rack_thunder_1",
                                              undercloud=True,
                                              username="******",
                                              password="******",
                                              ip_address="10.10.10.10",
                                              partition_name="shared",
                                              device_name_as_key=True)
FLAVOR_DEV2 = a10_data_models.HardwareThunder(project_id="project-2",
                                              device_name="rack_thunder_2",
                                              undercloud=True,
                                              username="******",
                                              password="******",
                                              ip_address="10.10.10.10",
                                              partition_name="shared")
FLAVOR_DEV3 = a10_data_models.HardwareThunder(project_id="project-1",
                                              device_name="rack_thunder_1",
                                              undercloud=True,
                                              username="******",
                                              password="******",
Ejemplo n.º 8
0
    'password': '******',
    'partition_name': 'def-sample'
}

DUP_PARTITION_HARDWARE_INFO = {
    'project_id': 'project-3',
    'ip_address': '10.10.10.10',
    'device_name': 'rack_thunder_3',
    'username': '******',
    'password': '******'
}

VTHUNDER_1 = data_models.HardwareThunder(project_id="project-1",
                                         device_name="rack_thunder_1",
                                         undercloud=True,
                                         username="******",
                                         password="******",
                                         ip_address="10.10.10.10",
                                         partition_name="shared")
VTHUNDER_2 = data_models.HardwareThunder(project_id="project-2",
                                         device_name="rack_thunder_2",
                                         undercloud=True,
                                         username="******",
                                         password="******",
                                         ip_address="12.12.12.12",
                                         partition_name="def-sample")

DUPLICATE_DICT = {'project_1': VTHUNDER_1, 'project_2': VTHUNDER_1}
DUP_LIST = ['10.10.10.10:shared']
NON_DUPLICATE_DICT = {'project_1': VTHUNDER_1, 'project_2': VTHUNDER_2}