예제 #1
0
class FlowClassifier(resource2.Resource):
    resource_key = 'flow_classifier'
    resources_key = 'flow_classifiers'
    base_path = '/sfc/flow_classifiers'
    service = network_service.NetworkService()

    allow_create = True
    allow_get = True
    allow_update = True
    allow_delete = True
    allow_list = True

    _query_mapping = resource2.QueryParameters('name')

    name = resource2.Body('name')
    description = resource2.Body('description')
    ethertype = resource2.Body('ingress')
    protocol = resource2.Body('protocol')
    source_port_range_min = resource2.Body('source_port_range_min')
    source_port_range_max = resource2.Body('source_port_range_max')
    destination_port_range_min = resource2.Body('destination_port_range_min')
    destination_port_range_max = resource2.Body('destination_port_range_max')
    source_ip_prefix = resource2.Body('source_ip_prefix')
    destination_ip_prefix = resource2.Body('destination_ip_prefix')
    logical_source_port = resource2.Body('logical_source_port')
    logical_destination_port = resource2.Body('logical_destination_port')
    l7_parameters = resource2.Body('l7_parameters', type=dict)
예제 #2
0
class Trunk(resource2.Resource):
    resource_key = 'trunk'
    resources_key = 'trunks'
    base_path = '/trunks'
    service = network_service.NetworkService()

    allow_create = True
    allow_get = True
    allow_update = True
    allow_delete = True
    allow_list = True

    status = resource2.Body('status')
    name = resource2.Body('name')
    port_id = resource2.Body('port_id')
    sub_ports = resource2.Body('sub_ports', type=list)

    def add_subports(self, session, **body):
        url = utils.urljoin(self.base_path, self.id, 'add_subports')
        resp = session.put(url, endpoint_filter=self.service, json=body)
        return resp.json()

    def remove_subports(self, session, **body):
        url = utils.urljoin(self.base_path, self.id, 'remove_subports')
        resp = session.put(url, endpoint_filter=self.service, json=body)
        return resp.json()
예제 #3
0
    def __init__(self, auth_url, project, username, password):
        self.res_serv_map = {}
        for serv in self.serv_reslist_map:
            for res in self.serv_reslist_map[serv]:
                self.res_serv_map[res] = serv

        self.connection_map = {}
        param = {
            'auth_url': auth_url,
            'project_name': project,
            'user_domain_name': 'default',
            'project_domain_name': 'default',
            'username': username,
            'password': password
        }

        for region in ('CentralRegion', 'RegionOne', 'RegionTwo'):
            prof = profile.Profile()
            if region == 'CentralRegion':
                serv = multiregion_network_service.MultiregionNetworkService(
                    version='v1')
                prof._add_service(serv)
            net_serv = network_service.NetworkService(version='v2')
            prof._add_service(net_serv)
            prof.set_region(profile.Profile.ALL, region)
            param['profile'] = prof
            conn = connection.Connection(**param)
            self.connection_map[region] = conn
예제 #4
0
class PortPairGroup(resource2.Resource):
    resource_key = 'port_pair_group'
    resources_key = 'port_pair_groups'
    base_path = '/sfc/port_pair_groups'
    service = network_service.NetworkService()

    allow_create = True
    allow_get = True
    allow_update = True
    allow_delete = True
    allow_list = True

    _query_mapping = resource2.QueryParameters('name')

    name = resource2.Body('name')
    description = resource2.Body('description')
    port_pairs = resource2.Body('port_pairs', type=list)
    port_pair_group_parameters = resource2.Body('port_pair_group_parameters',
                                                type=dict)
예제 #5
0
class PortPair(resource2.Resource):
    resource_key = 'port_pair'
    resources_key = 'port_pairs'
    base_path = '/sfc/port_pairs'
    service = network_service.NetworkService()

    allow_create = True
    allow_get = True
    allow_update = True
    allow_delete = True
    allow_list = True

    _query_mapping = resource2.QueryParameters('name')

    name = resource2.Body('name')
    description = resource2.Body('description')
    ingress = resource2.Body('ingress')
    egress = resource2.Body('egress')
    service_function_parameters = resource2.Body('service_function_parameters',
                                                 type=dict)
예제 #6
0
    def __init__(self, auth_url, project, username, password,
                 project_domain_id, user_domain_id):
        self.res_serv_map = {}
        for serv in self.serv_reslist_map:
            for res in self.serv_reslist_map[serv]:
                self.res_serv_map[res] = serv

        self.connection_map = {}
        auth = {
            'auth_url': auth_url,
            'project_name': project,
            'user_domain_name': 'default',
            'project_domain_name': 'default',
            'username': username,
            'password': password,
            'project_domain_id': project_domain_id,
            'user_domain_id': user_domain_id
        }

        for region in ('CentralRegion', 'RegionOne', 'RegionTwo'):
            extra_services = []
            if region == 'CentralRegion':
                serv = multiregion_network_service.MultiregionNetworkService(
                    version='v1')
                extra_services.append(serv)
            net_serv = network_service.NetworkService(version='v2')
            extra_services.append(net_serv)
            conn = connection.Connection(region_name=region,
                                         auth=auth,
                                         extra_services=extra_services)
            conn.config.config['network_sdk_service_type'] = 'network'
            conn.config.config['tricircle_sdk_service_type'] = 'tricircle'
            conn.config.config['network_sdk_api_version'] = 'v2'
            conn.config.config['tricircle_sdk_api_version'] = 'v1'
            for service in extra_services:
                conn.add_service(service)
            self.connection_map[region] = conn