def get_resources(cls): """Returns Ext Resources.""" exts = [] plugin = manager.NeutronManager.get_plugin() # subnets collection_name = SUBNETS params = RESOURCE_ATTRIBUTE_MAP.get(collection_name, dict()) subnet_controller = base.create_resource( collection_name, SUBNET, plugin, params, allow_bulk=True) ex = extensions.ResourceExtension(collection_name, subnet_controller) exts.append(ex) # hosts parent = dict(member_name=SUBNET, collection_name=SUBNETS) collection_name = DHCP_HOSTS params = RESOURCE_ATTRIBUTE_MAP.get(collection_name, dict()) host_controller = base.create_resource( collection_name, DHCP_HOST, plugin, params, parent=parent, allow_bulk=True) ex = extensions.ResourceExtension( collection_name, host_controller, parent=parent) exts.append(ex) return exts
def get_resources(self): collection = self.HYPHENATED_COLLECTION.replace('_', '-') params = self.RAM.get(self.HYPHENATED_COLLECTION, {}) attributes.PLURALS.update({self.HYPHENATED_COLLECTION: self.HYPHENATED_RESOURCE}) fake_plugin = FakePlugin() controller = base.create_resource( collection, self.HYPHENATED_RESOURCE, FakePlugin(), params, allow_bulk=True, allow_pagination=True, allow_sorting=True) resources = [extensions.ResourceExtension(collection, controller, attr_map=params)] for collection_name in self.SUB_RESOURCE_ATTRIBUTE_MAP: resource_name = collection_name parent = self.SUB_RESOURCE_ATTRIBUTE_MAP[collection_name].get( 'parent') params = self.SUB_RESOURCE_ATTRIBUTE_MAP[collection_name].get( 'parameters') controller = base.create_resource(collection_name, resource_name, fake_plugin, params, allow_bulk=True, parent=parent) resource = extensions.ResourceExtension( collection_name, controller, parent, path_prefix="", attr_map=params) resources.append(resource) return resources
def get_resources(cls): exts = list() plugin = manager.NeutronManager.get_plugin() resource_name = TUNNELZONE collection_name = TUNNELZONES params = RESOURCE_ATTRIBUTE_MAP.get(collection_name, dict()) controller = base.create_resource(collection_name, resource_name, plugin, params, allow_bulk=False) ex = extensions.ResourceExtension(collection_name, controller) exts.append(ex) # Tunnel Zone Host parent = dict(member_name=resource_name, collection_name=collection_name) tunnelzone_plugin = manager.NeutronManager.get_service_plugins().get( TUNNELZONE) resource_name = TUNNELZONE_HOST collection_name = TUNNELZONE_HOSTS params = RESOURCE_ATTRIBUTE_MAP.get(collection_name, dict()) tunnelzonehost_controller = base.create_resource( collection_name, resource_name, tunnelzone_plugin, params, parent=parent, allow_bulk=True) tunnelzonehost_extension = extensions.ResourceExtension( collection_name, tunnelzonehost_controller, parent=parent) exts.append(tunnelzonehost_extension) return exts
def get_resources(cls): my_plurals = [(key, key[:-1]) for key in RESOURCE_ATTRIBUTE_MAP.keys()] my_plurals.append(("health_monitors_status", "health_monitor_status")) attr.PLURALS.update(dict(my_plurals)) resources = [] plugin = manager.NeutronManager.get_service_plugins()[constants.LOADBALANCER] for collection_name in RESOURCE_ATTRIBUTE_MAP: # Special handling needed for resources with 'y' ending # (e.g. proxies -> proxy) resource_name = collection_name[:-1] params = RESOURCE_ATTRIBUTE_MAP[collection_name] member_actions = {} if resource_name == "pool": member_actions = {"stats": "GET"} controller = base.create_resource( collection_name, resource_name, plugin, params, member_actions=member_actions, allow_pagination=cfg.CONF.allow_pagination, allow_sorting=cfg.CONF.allow_sorting, ) resource = extensions.ResourceExtension( collection_name, controller, path_prefix=constants.COMMON_PREFIXES[constants.LOADBALANCER], member_actions=member_actions, attr_map=params, ) resources.append(resource) for collection_name in SUB_RESOURCE_ATTRIBUTE_MAP: # Special handling needed for sub-resources with 'y' ending # (e.g. proxies -> proxy) resource_name = collection_name[:-1] parent = SUB_RESOURCE_ATTRIBUTE_MAP[collection_name].get("parent") params = SUB_RESOURCE_ATTRIBUTE_MAP[collection_name].get("parameters") controller = base.create_resource( collection_name, resource_name, plugin, params, allow_bulk=True, parent=parent ) resource = extensions.ResourceExtension( collection_name, controller, parent, path_prefix=constants.COMMON_PREFIXES[constants.LOADBALANCER], attr_map=params, ) resources.append(resource) return resources
def get_resources(cls): params = RESOURCE_ATTRIBUTE_MAP.get(COLLECTION_NAME, dict()) controller = base.create_resource(COLLECTION_NAME, EXT_ALIAS, plugin.Plugin.get_instance(), params, allow_bulk=False) return [extensions.ResourceExtension(EXT_ALIAS, controller)]
def get_resources(cls): attr.validators['type:peer_cidr'] = _validate_openvpn_cidr plural_mapping = { 'openvpnconnections': 'openvpnconnection' } my_plurals = [] for plural in RESOURCE_ATTRIBUTE_MAP: singular = plural_mapping.get(plural, plural[:-1]) my_plurals.append((plural, singular)) attr.PLURALS.update(dict(my_plurals)) resources = [] plugin = manager.NeutronManager.get_service_plugins()[ constants.VPN] for collection_name in RESOURCE_ATTRIBUTE_MAP: resource_name = plural_mapping.get( collection_name, collection_name[:-1]) params = RESOURCE_ATTRIBUTE_MAP[collection_name] collection_name = collection_name.replace('_', '-') quota.QUOTAS.register_resource_by_name(resource_name) member_actions = { 'get_client_certificate':'GET', } controller = base.create_resource( collection_name, resource_name, plugin, params, member_actions=member_actions, allow_pagination=cfg.CONF.allow_pagination, allow_sorting=cfg.CONF.allow_sorting) ext = extensions.ResourceExtension(resource_name+'s', controller, path_prefix=constants.COMMON_PREFIXES[constants.VPN], member_actions=member_actions) resources.append(ext) return resources
def get_resources(cls): """Returns Ext Resources.""" plural_mappings = resource_helper.build_plural_mappings( {}, RESOURCE_ATTRIBUTE_MAP) attr.PLURALS.update(plural_mappings) resources = resource_helper.build_resource_info( plural_mappings, RESOURCE_ATTRIBUTE_MAP, constants.FLAVORS) plugin = manager.NeutronManager.get_service_plugins()[ constants.FLAVORS] for collection_name in SUB_RESOURCE_ATTRIBUTE_MAP: # Special handling needed for sub-resources with 'y' ending # (e.g. proxies -> proxy) resource_name = collection_name[:-1] parent = SUB_RESOURCE_ATTRIBUTE_MAP[collection_name].get('parent') params = SUB_RESOURCE_ATTRIBUTE_MAP[collection_name].get( 'parameters') controller = base.create_resource(collection_name, resource_name, plugin, params, allow_bulk=True, parent=parent) resource = extensions.ResourceExtension( collection_name, controller, parent, path_prefix=FLAVORS_PREFIX, attr_map=params) resources.append(resource) return resources
def get_resources(cls): plural_mapping = { 'vpnusers': 'vpnuser', } my_plurals = [] for plural in RESOURCE_ATTRIBUTE_MAP: singular = plural_mapping.get(plural, plural[:-1]) my_plurals.append((plural, singular)) attr.PLURALS.update(dict(my_plurals)) resources = [] plugin = manager.NeutronManager.get_service_plugins()[ constants.VPN] for collection_name in RESOURCE_ATTRIBUTE_MAP: resource_name = plural_mapping.get( collection_name, collection_name[:-1]) params = RESOURCE_ATTRIBUTE_MAP[collection_name] collection_name = collection_name.replace('_', '-') quota.QUOTAS.register_resource_by_name(resource_name) controller = base.create_resource( collection_name, resource_name, plugin, params, allow_pagination=cfg.CONF.allow_pagination, allow_sorting=cfg.CONF.allow_sorting) resource = extensions.ResourceExtension( collection_name, controller, path_prefix=constants.COMMON_PREFIXES[constants.VPN], attr_map=params) resources.append(resource) return resources
def build_resource_info(plural_mappings, resource_map, which_service, action_map=None, register_quota=False, translate_name=False, allow_bulk=False): resources = [] if not which_service: which_service = constants.CORE if action_map is None: action_map = {} if which_service != constants.CORE: plugin = manager.NeutronManager.get_service_plugins()[which_service] else: plugin = manager.NeutronManager.get_plugin() for collection_name in resource_map: resource_name = plural_mappings[collection_name] params = resource_map.get(collection_name, {}) if translate_name: collection_name = collection_name.replace('_', '-') if register_quota: quota.QUOTAS.register_resource_by_name(resource_name) member_actions = action_map.get(resource_name, {}) controller = base.create_resource( collection_name, resource_name, plugin, params, member_actions=member_actions, allow_bulk=allow_bulk, allow_pagination=cfg.CONF.allow_pagination, allow_sorting=cfg.CONF.allow_sorting) resource = extensions.ResourceExtension( collection_name, controller, path_prefix=skycloud_constants.PORT_FORWARD_PATH_PREFIX, member_actions=member_actions, attr_map=params) resources.append(resource) return resources
def get_resources(cls): """Returns Ext Resources.""" special_mappings = {"policies": "policy"} plural_mappings = resource_helper.build_plural_mappings( special_mappings, itertools.chain(RESOURCE_ATTRIBUTE_MAP, SUB_RESOURCE_ATTRIBUTE_MAP) ) attr.PLURALS.update(plural_mappings) resources = resource_helper.build_resource_info( plural_mappings, RESOURCE_ATTRIBUTE_MAP, constants.QOS, translate_name=True, allow_bulk=True ) plugin = manager.NeutronManager.get_service_plugins()[constants.QOS] for collection_name in SUB_RESOURCE_ATTRIBUTE_MAP: resource_name = collection_name[:-1] parent = SUB_RESOURCE_ATTRIBUTE_MAP[collection_name].get("parent") params = SUB_RESOURCE_ATTRIBUTE_MAP[collection_name].get("parameters") controller = base.create_resource( collection_name, resource_name, plugin, params, allow_bulk=True, parent=parent, allow_pagination=True, allow_sorting=True, ) resource = extensions.ResourceExtension( collection_name, controller, parent, path_prefix=QOS_PREFIX, attr_map=params ) resources.append(resource) return resources
def get_resources(cls): plural_mappings = resource_helper.build_plural_mappings( {}, RESOURCE_ATTRIBUTE_MAP) plural_mappings['health_monitors_status'] = 'health_monitor_status' attr.PLURALS.update(plural_mappings) action_map = {'pool': {'stats': 'GET'}} resources = resource_helper.build_resource_info(plural_mappings, RESOURCE_ATTRIBUTE_MAP, constants.LOADBALANCER, action_map=action_map) plugin = manager.NeutronManager.get_service_plugins()[ constants.LOADBALANCER] for collection_name in SUB_RESOURCE_ATTRIBUTE_MAP: # Special handling needed for sub-resources with 'y' ending # (e.g. proxies -> proxy) resource_name = collection_name[:-1] parent = SUB_RESOURCE_ATTRIBUTE_MAP[collection_name].get('parent') params = SUB_RESOURCE_ATTRIBUTE_MAP[collection_name].get( 'parameters') controller = base.create_resource(collection_name, resource_name, plugin, params, allow_bulk=True, parent=parent) resource = extensions.ResourceExtension( collection_name, controller, parent, path_prefix=constants.COMMON_PREFIXES[constants.LOADBALANCER], attr_map=params) resources.append(resource) return resources
def get_resources(cls): plugin = directory.get_plugin() params = pbe_ext.SUB_RESOURCE_ATTRIBUTE_MAP[ pbe_ext.COLLECTION_NAME]['parameters'] # TODO(hongbin): Delete _populate_is_filter_keyword once neutron-lib # containing https://review.openstack.org/#/c/583437/ is released. cls._populate_is_filter_keyword(params) parent = pbe_ext.SUB_RESOURCE_ATTRIBUTE_MAP[ pbe_ext.COLLECTION_NAME]['parent'] controller = base.create_resource( pbe_ext.COLLECTION_NAME, pbe_ext.RESOURCE_NAME, plugin, params, member_actions=pbe_ext.ACTION_MAP[pbe_ext.RESOURCE_NAME], parent=parent, allow_pagination=True, allow_sorting=True, ) exts = [ extensions.ResourceExtension( pbe_ext.COLLECTION_NAME, controller, parent, member_actions=pbe_ext.ACTION_MAP[pbe_ext.RESOURCE_NAME], attr_map=params, ), ] return exts
def get_resources(cls): plugin = directory.get_plugin() params = pbe_ext.SUB_RESOURCE_ATTRIBUTE_MAP[ pbe_ext.COLLECTION_NAME]['parameters'] parent = pbe_ext.SUB_RESOURCE_ATTRIBUTE_MAP[ pbe_ext.COLLECTION_NAME]['parent'] controller = base.create_resource( pbe_ext.COLLECTION_NAME, pbe_ext.RESOURCE_NAME, plugin, params, member_actions=pbe_ext.ACTION_MAP[pbe_ext.RESOURCE_NAME], parent=parent, allow_pagination=True, allow_sorting=True, ) exts = [ extensions.ResourceExtension( pbe_ext.COLLECTION_NAME, controller, parent, member_actions=pbe_ext.ACTION_MAP[pbe_ext.RESOURCE_NAME], attr_map=params, ), ] return exts
def get_resources(cls): """Returns Ext Resources.""" plural_mappings = resource_helper.build_plural_mappings( {}, apidef.RESOURCE_ATTRIBUTE_MAP) resources = resource_helper.build_resource_info( plural_mappings, apidef.RESOURCE_ATTRIBUTE_MAP, constants.FLAVORS) plugin = directory.get_plugin(constants.FLAVORS) for collection_name in apidef.SUB_RESOURCE_ATTRIBUTE_MAP: # Special handling needed for sub-resources with 'y' ending # (e.g. proxies -> proxy) resource_name = collection_name[:-1] parent = apidef.SUB_RESOURCE_ATTRIBUTE_MAP[collection_name].get( 'parent') params = apidef.SUB_RESOURCE_ATTRIBUTE_MAP[collection_name].get( 'parameters') controller = base.create_resource(collection_name, resource_name, plugin, params, allow_bulk=True, parent=parent) resource = extensions.ResourceExtension( collection_name, controller, parent, path_prefix=apidef.API_PREFIX, attr_map=params) resources.append(resource) return resources
def get_resources(cls): """Returns Ext Resources.""" my_plurals = [(key, key[:-1]) for key in RESOURCE_ATTRIBUTE_MAP.keys()] attr.PLURALS.update(dict(my_plurals)) exts = [] plugin = manager.NeutronManager.get_plugin() for resource_name in ['router', 'floatingip']: collection_name = resource_name + "s" params = RESOURCE_ATTRIBUTE_MAP.get(collection_name, dict()) member_actions = {} if resource_name == 'router': member_actions = {'add_router_interface': 'PUT', 'remove_router_interface': 'PUT'} quota.QUOTAS.register_resource_by_name(resource_name) controller = base.create_resource( collection_name, resource_name, plugin, params, member_actions=member_actions, allow_pagination=cfg.CONF.allow_pagination, allow_sorting=cfg.CONF.allow_sorting) ex = extensions.ResourceExtension(collection_name, controller, member_actions=member_actions, attr_map=params) exts.append(ex) return exts
def get_resources(cls): """Returns Ext Resources.""" my_plurals = [(key, key[:-1]) for key in RESOURCE_ATTRIBUTE_MAP.keys()] attr.PLURALS.update(dict(my_plurals)) exts = [] plugin = manager.NeutronManager.get_service_plugins()[constants.METERING] for resource_name in ["metering_label", "metering_label_rule"]: collection_name = resource_name + "s" collection_name = collection_name.replace("_", "-") params = RESOURCE_ATTRIBUTE_MAP.get(resource_name + "s", dict()) controller = base.create_resource( collection_name, resource_name, plugin, params, allow_bulk=True, allow_pagination=True, allow_sorting=True, ) ex = extensions.ResourceExtension( collection_name, controller, path_prefix=constants.COMMON_PREFIXES[constants.METERING], attr_map=params ) exts.append(ex) return exts
def get_resources(cls): """Returns Extended Resource for dummy management.""" dummy_inst = directory.get_plugin(DUMMY_SERVICE_TYPE) controller = base.create_resource( COLLECTION_NAME, RESOURCE_NAME, dummy_inst, RESOURCE_ATTRIBUTE_MAP[COLLECTION_NAME]) return [extensions.ResourceExtension(COLLECTION_NAME, controller)]
def get_resources(cls): """Returns Extended Resource for dummy management.""" n_mgr = manager.NeutronManager.get_instance() dummy_inst = n_mgr.get_service_plugins()["DUMMY"] controller = base.create_resource( COLLECTION_NAME, RESOURCE_NAME, dummy_inst, RESOURCE_ATTRIBUTE_MAP[COLLECTION_NAME] ) return [extensions.ResourceExtension(COLLECTION_NAME, controller)]
def get_resources(cls): """Returns Extended Resources.""" resource_name = "credential" collection_name = resource_name + "s" plugin = manager.NeutronManager.get_plugin() params = RESOURCE_ATTRIBUTE_MAP.get(collection_name, dict()) controller = base.create_resource(collection_name, resource_name, plugin, params) return [extensions.ResourceExtension(collection_name, controller)]
def get_resources(self): exts = list() plugin = manager.NeutronManager.get_plugin() params = RESOURCE_ATTRIBUTE_MAP.get(attributes.FLOWRULES, dict()) controller = base.create_resource(attributes.FLOWRULES, attributes.FLOWRULE, plugin, params, allow_bulk=False) ex = extensions.ResourceExtension(attributes.FLOWRULES, controller) exts.append(ex) return exts
def get_resources(cls): params = RESOURCE_ATTRIBUTE_MAP.get(COLLECTION_NAME, dict()) controller = base.create_resource(COLLECTION_NAME, EXT_ALIAS, manager.NeutronManager. get_service_plugins()[EXT_ALIAS], params, allow_bulk=False) return [extensions.ResourceExtension(EXT_ALIAS, controller)]
def build_resource_info(plural_mappings, resource_map, which_service, action_map=None, register_quota=False, translate_name=False, allow_bulk=False): """Build resources for advanced services. Takes the resource information, and singular/plural mappings, and creates API resource objects for advanced services extensions. Will optionally translate underscores to dashes in resource names, register the resource, and accept action information for resources. :param plural_mappings: mappings between singular and plural forms :param resource_map: attribute map for the WSGI resources to create :param which_service: The name of the service for which the WSGI resources are being created. This name will be used to pass the appropriate plugin to the WSGI resource. It can be set to None or "CORE" to create WSGI resources for the core plugin :param action_map: custom resource actions :param register_quota: it can be set to True to register quotas for the resource(s) being created :param translate_name: replaces underscores with dashes :param allow_bulk: True if bulk create are allowed """ resources = [] if not which_service: which_service = constants.CORE if action_map is None: action_map = {} if which_service != constants.CORE: plugin = manager.NeutronManager.get_service_plugins()[which_service] else: plugin = manager.NeutronManager.get_plugin() path_prefix = getattr(plugin, "path_prefix", "") LOG.debug('Service %(service)s assigned prefix: %(prefix)s', {'service': which_service, 'prefix': path_prefix}) for collection_name in resource_map: resource_name = plural_mappings[collection_name] params = resource_map.get(collection_name, {}) if translate_name: collection_name = collection_name.replace('_', '-') if register_quota: resource_registry.register_resource_by_name(resource_name) member_actions = action_map.get(resource_name, {}) controller = base.create_resource( collection_name, resource_name, plugin, params, member_actions=member_actions, allow_bulk=allow_bulk, allow_pagination=cfg.CONF.allow_pagination, allow_sorting=cfg.CONF.allow_sorting) resource = extensions.ResourceExtension( collection_name, controller, path_prefix=path_prefix, member_actions=member_actions, attr_map=params) resources.append(resource) return resources
def get_resources(cls): qresource = quota.CountableResource(RESOURCE, quota._count_resource, "quota_%s" % RESOURCE) quota.QUOTAS.register_resource(qresource) resource = base.create_resource( COLLECTION, RESOURCE, manager.NeutronManager.get_plugin(), PACKET_FILTER_ATTR_PARAMS ) pf_ext = extensions.ResourceExtension(COLLECTION, resource, attr_map=PACKET_FILTER_ATTR_PARAMS) return [pf_ext]
def get_resources(self): collection = self.HYPHENATED_COLLECTION.replace('_', '-') params = self.RAM.get(self.HYPHENATED_COLLECTION, {}) controller = base.create_resource( collection, self.HYPHENATED_RESOURCE, FakePlugin(), params, allow_bulk=True, allow_pagination=True, allow_sorting=True) return [extensions.ResourceExtension(collection, controller, attr_map=params)]
def get_resources(cls): """Returns Ext Resources.""" plugin = directory.get_plugin() params = az_def.RESOURCE_ATTRIBUTE_MAP.get(az_def.COLLECTION_NAME) controller = base.create_resource(az_def.COLLECTION_NAME, az_def.RESOURCE_NAME, plugin, params) ex = extensions.ResourceExtension(az_def.COLLECTION_NAME, controller) return [ex]
def get_resources(cls): exts = [] plugin = manager.NeutronManager.get_plugin() collection_name = CLUSTERS params = RESOURCE_ATTRIBUTE_MAP.get(collection_name, dict()) controller = base.create_resource( collection_name, CLUSTER, plugin, params) ex = extensions.ResourceExtension(collection_name, controller) exts.append(ex) return exts
def get_resources(cls): """Returns Ext Resources.""" plugin = directory.get_plugin() params = RESOURCE_ATTRIBUTE_MAP.get(AVAILABILITY_ZONES) controller = base.create_resource(AVAILABILITY_ZONES, RESOURCE_NAME, plugin, params) ex = extensions.ResourceExtension(AVAILABILITY_ZONES, controller) return [ex]
def get_resources(cls): """Returns Extended Resource for service type management.""" resource_attributes = RESOURCE_ATTRIBUTE_MAP[RESOURCE_PLURAL] controller = base.create_resource( RESOURCE_PLURAL, RESOURCE_NAME, plugin.NetworkIPAvailabilityPlugin.get_instance(), resource_attributes) return [extensions.ResourceExtension(COLLECTION_NAME, controller, attr_map=resource_attributes)]
def get_resources(cls): """Returns Extended Resource for service type management.""" resource_attributes = RESOURCE_ATTRIBUTE_MAP[SEGMENTS] controller = base.create_resource( SEGMENTS, SEGMENT, directory.get_plugin(SEGMENTS), resource_attributes) return [extensions.ResourceExtension(SEGMENTS, controller, attr_map=resource_attributes)]
def get_resources(cls): """Returns Ext Resources.""" my_plurals = [(key, key[:-1]) for key in RESOURCE_ATTRIBUTE_MAP.keys()] attr.PLURALS.update(dict(my_plurals)) plugin = manager.NeutronManager.get_plugin() params = RESOURCE_ATTRIBUTE_MAP.get(RESOURCE_NAME + "s") controller = base.create_resource(RESOURCE_NAME + "s", RESOURCE_NAME, plugin, params) ex = extensions.ResourceExtension(RESOURCE_NAME + "s", controller) return [ex]
def get_resources(cls): """Returns Extended Resource for service type management.""" attr_map = RESOURCE_ATTRIBUTE_MAP[COLLECTION_NAME] collection_name = COLLECTION_NAME.replace('_', '-') controller = base.create_resource( collection_name, RESOURCE_NAME, servicetype_db.ServiceTypeManager.get_instance(), attr_map) return [ extensions.ResourceExtension(collection_name, controller, attr_map=attr_map) ]
def get_resources(cls): """Returns Extended Resource for service type management.""" resource_attributes = RESOURCE_ATTRIBUTE_MAP[RESOURCE_PLURAL] controller = base.create_resource( RESOURCE_PLURAL, RESOURCE_NAME, plugin.NetworkIPAvailabilityPlugin.get_instance(), resource_attributes) return [ extensions.ResourceExtension(COLLECTION_NAME, controller, attr_map=resource_attributes) ]
def get_resources(cls): """Returns Extended Resource for service type management.""" attributes.PLURALS[SEGMENTS] = SEGMENT resource_attributes = RESOURCE_ATTRIBUTE_MAP[SEGMENTS] controller = base.create_resource(SEGMENTS, SEGMENT, plugin.Plugin.get_instance(), resource_attributes) return [ extensions.ResourceExtension(SEGMENTS, controller, attr_map=resource_attributes) ]
def get_resources(cls): """Returns Ext Resources.""" my_plurals = [(key, key[:-1]) for key in RESOURCE_ATTRIBUTE_MAP.keys()] attr.PLURALS.update(dict(my_plurals)) plugin = manager.NeutronManager.get_plugin() params = RESOURCE_ATTRIBUTE_MAP.get(AVAILABILITY_ZONES) controller = base.create_resource(AVAILABILITY_ZONES, RESOURCE_NAME, plugin, params) ex = extensions.ResourceExtension(AVAILABILITY_ZONES, controller) return [ex]
def get_resources(cls): qresource = quota.CountableResource(RESOURCE, quota._count_resource, 'quota_%s' % RESOURCE) quota.QUOTAS.register_resource(qresource) resource = base.create_resource(COLLECTION, RESOURCE, manager.NeutronManager.get_plugin(), PACKET_FILTER_ATTR_PARAMS) pf_ext = extensions.ResourceExtension( COLLECTION, resource, attr_map=PACKET_FILTER_ATTR_PARAMS) return [pf_ext]
def get_resources(cls): """Returns Ext Resources.""" plugin = directory.get_plugin( nuage_constants.NUAGE_L2BRIDGE_SERVICE_PLUGIN) resource_name = 'nuage_l2bridge' collection_name = resource_name.replace('_', '-') + "s" params = RESOURCE_ATTRIBUTE_MAP.get(resource_name + "s", dict()) resource_registry.register_resource_by_name(resource_name) controller = base.create_resource(collection_name, resource_name, plugin, params, allow_bulk=True) ex = extensions.ResourceExtension(collection_name, controller) return [ex]
def get_resources(cls): """Returns Extended Resources.""" exts = [] plugin = bc.get_plugin(constants.CISCO_N1KV) for resource_name in [POLICY_PROFILE, 'policy_profile_binding']: collection_name = resource_name + 's' controller = base.create_resource( collection_name, resource_name, plugin, RESOURCE_ATTRIBUTE_MAP.get(collection_name)) ex = extensions.ResourceExtension(collection_name, controller) exts.append(ex) return exts
def get_resources(cls): """Returns Ext Resources.""" plugin = directory.get_plugin() params = apidef.RESOURCE_ATTRIBUTE_MAP.get(apidef.COLLECTION_NAME) controller = base.create_resource(apidef.COLLECTION_NAME, apidef.RESOURCE_NAME, plugin, params) ex = extensions.ResourceExtension(apidef.COLLECTION_NAME, controller) return [ex]
def get_resources(cls): """Returns Extended Resources.""" exts = [] plugin = manager.NeutronManager.get_plugin() for resource_name in ['network_profile', 'network_profile_binding']: collection_name = resource_name + "s" controller = base.create_resource( collection_name, resource_name, plugin, RESOURCE_ATTRIBUTE_MAP.get(collection_name)) ex = extensions.ResourceExtension(collection_name, controller) exts.append(ex) return exts
def get_resources(self): collection = self.HYPHENATED_COLLECTION.replace('_', '-') params = self.RAM.get(self.HYPHENATED_COLLECTION, {}) attributes.PLURALS.update( {self.HYPHENATED_COLLECTION: self.HYPHENATED_RESOURCE}) fake_plugin = FakePlugin() controller = base.create_resource(collection, self.HYPHENATED_RESOURCE, FakePlugin(), params, allow_bulk=True, allow_pagination=True, allow_sorting=True) resources = [ extensions.ResourceExtension(collection, controller, attr_map=params) ] for collection_name in self.SUB_RESOURCE_ATTRIBUTE_MAP: resource_name = collection_name parent = self.SUB_RESOURCE_ATTRIBUTE_MAP[collection_name].get( 'parent') params = self.SUB_RESOURCE_ATTRIBUTE_MAP[collection_name].get( 'parameters') controller = base.create_resource(collection_name, resource_name, fake_plugin, params, allow_bulk=True, parent=parent) resource = extensions.ResourceExtension(collection_name, controller, parent, path_prefix="", attr_map=params) resources.append(resource) return resources
def get_resources(cls): plugin = directory.get_plugin(PLUGIN_TYPE) collection_name = local_ip_apidef.COLLECTION_NAME.replace('_', '-') params = local_ip_apidef.RESOURCE_ATTRIBUTE_MAP.get( local_ip_apidef.COLLECTION_NAME, dict()) controller = base.create_resource(collection_name, local_ip_apidef.RESOURCE_NAME, plugin, params, allow_bulk=True, allow_pagination=True, allow_sorting=True) ext = extensions.ResourceExtension(collection_name, controller, attr_map=params) resources = [ext] for collection_name in local_ip_apidef.SUB_RESOURCE_ATTRIBUTE_MAP: resource_name = local_ip_apidef.LOCAL_IP_ASSOCIATION parent = local_ip_apidef.SUB_RESOURCE_ATTRIBUTE_MAP[ collection_name].get('parent') params = local_ip_apidef.SUB_RESOURCE_ATTRIBUTE_MAP[ collection_name].get('parameters') controller = base.create_resource(collection_name, resource_name, plugin, params, allow_bulk=True, parent=parent, allow_pagination=True, allow_sorting=True) resource = extensions.ResourceExtension(collection_name, controller, parent, attr_map=params) resources.append(resource) return resources
def get_resources(cls): """Returns Ext Resources.""" plugin = directory.get_plugin(nuage_constants.NUAGE_PLUGIN_STATS) resource_name = 'nuage_plugin_stats' collection_name = resource_name.replace('_', '-') params = RESOURCE_ATTRIBUTE_MAP.get(resource_name, dict()) resource_registry.register_resource_by_name(resource_name) controller = base.create_resource(collection_name, resource_name, plugin, params, allow_bulk=True) return [extensions.ResourceExtension(collection_name, controller)]
def get_resources(cls): """Returns Extended Resource for service type management.""" plural = {RESOURCE_PLURAL: RESOURCE_NAME} attributes.PLURALS.update(dict(plural)) resource_attributes = RESOURCE_ATTRIBUTE_MAP[RESOURCE_PLURAL] controller = base.create_resource(RESOURCE_PLURAL, RESOURCE_NAME, plugin.IpUsagePlugin.get_instance(), resource_attributes) return [ extensions.ResourceExtension(COLLECTION_NAME, controller, attr_map=resource_attributes) ]
def get_resources(cls): params = auto_allocated_topology.RESOURCE_ATTRIBUTE_MAP.get( auto_allocated_topology.COLLECTION_NAME, dict()) controller = base.create_resource( auto_allocated_topology.COLLECTION_NAME, auto_allocated_topology.ALIAS, directory.get_plugin(auto_allocated_topology.ALIAS), params, allow_bulk=False) return [ extensions.ResourceExtension(auto_allocated_topology.ALIAS, controller) ]
def get_resources(cls): """Returns Ext Resources.""" plugin = directory.get_plugin() params = RESOURCE_ATTRIBUTE_MAP['rbac_policies'] collection_name = 'rbac-policies' resource_name = 'rbac_policy' resource_registry.register_resource_by_name(resource_name) controller = base.create_resource(collection_name, resource_name, plugin, params, allow_bulk=True, allow_pagination=False, allow_sorting=True) return [extensions.ResourceExtension(collection_name, controller, attr_map=params)]
def get_resources(cls): """Returns Extended Resources.""" exts = [] plugin = (manager.NeutronManager.get_service_plugins()[ constants.CISCO_N1KV_NET_PROFILE]) resource_name = NETWORK_PROFILE collection_name = NETWORK_PROFILES controller = base.create_resource( collection_name, resource_name, plugin, RESOURCE_ATTRIBUTE_MAP.get(collection_name)) ex = extensions.ResourceExtension(collection_name, controller) exts.append(ex) return exts
def get_resources(cls): """Returns Ext Resources.""" exts = [] plugin = directory.get_plugin() resource_name = ALIAS collection_name = resource_name.replace('_', '-') + "s" params = RESOURCE_ATTRIBUTE_MAP.get(COLLECTION_NAME, dict()) controller = base.create_resource(collection_name, resource_name, plugin, params, allow_bulk=False) ex = extensions.ResourceExtension(collection_name, controller) exts.append(ex) return exts
def get_resources(cls): """Returns Ext Resources.""" plugin = manager.NeutronManager.get_plugin() # system resource_name = SYSTEM collection_name = SYSTEMS params = RESOURCE_ATTRIBUTE_MAP.get(collection_name, dict()) controller = base.create_resource(collection_name, resource_name, plugin, params) ex = extensions.ResourceExtension(collection_name, controller) return [ex]
def get_resources(cls): """Returns Ext Resources.""" plugin = directory.get_plugin() params = RESOURCE_ATTRIBUTE_MAP.get(RESOURCE_NAME + 's') controller = base.create_resource(RESOURCE_NAME + 's', RESOURCE_NAME, plugin, params ) ex = extensions.ResourceExtension(RESOURCE_NAME + 's', controller) return [ex]
def get_resources(cls): """Returns Ext Resources.""" exts = [] plugin = manager.NeutronManager.get_plugin() # Chains collection_name = CHAINS params = RESOURCE_ATTRIBUTE_MAP.get(collection_name, dict()) chain_controller = base.create_resource(collection_name, CHAIN, plugin, params) ex = extensions.ResourceExtension(collection_name, chain_controller) exts.append(ex) # Rules collection_name = RULES params = RESOURCE_ATTRIBUTE_MAP.get(collection_name, dict()) rule_controller = base.create_resource(collection_name, RULE, plugin, params) ex = extensions.ResourceExtension(collection_name, rule_controller) exts.append(ex) return exts
def get_resources(cls): """Returns Extended Resource for service type management.""" resource_attributes = RESOURCE_ATTRIBUTE_MAP[SEGMENTS] controller = base.create_resource( SEGMENTS, SEGMENT, directory.get_plugin(SEGMENTS), resource_attributes, allow_pagination=True, allow_sorting=True) return [extensions.ResourceExtension(SEGMENTS, controller, attr_map=resource_attributes)]
def get_resources(self): """Returns Ext Resources.""" resources = [] fake_plugin = FakePlugin() for collection_name in self.RESOURCE_ATTRIBUTE_MAP: resource_name = collection_name[:-1] params = self.RESOURCE_ATTRIBUTE_MAP.get(collection_name, {}) attributes.PLURALS.update({collection_name: resource_name}) member_actions = {'put_meh': 'PUT', 'boo_meh': 'GET'} if collection_name == self.HYPHENATED_COLLECTION: collection_name = collection_name.replace('_', '-') controller = base.create_resource( collection_name, resource_name, fake_plugin, params, allow_bulk=True, allow_pagination=True, allow_sorting=True, member_actions=member_actions) resource = extensions.ResourceExtension( collection_name, controller, attr_map=params) resources.append(resource) for collection_name in self.SUB_RESOURCE_ATTRIBUTE_MAP: resource_name = collection_name[:-1] parent = self.SUB_RESOURCE_ATTRIBUTE_MAP[collection_name].get( 'parent') params = self.SUB_RESOURCE_ATTRIBUTE_MAP[collection_name].get( 'parameters') controller = base.create_resource(collection_name, resource_name, fake_plugin, params, allow_bulk=True, parent=parent) resource = extensions.ResourceExtension( collection_name, controller, parent, path_prefix="", attr_map=params) resources.append(resource) return resources
def get_resources(cls): """Returns Ext Resources.""" exts = [] plugin = manager.NeutronManager.get_plugin() resource_name = PORT collection_name = PORTS params = RESOURCE_ATTRIBUTE_MAP.get(collection_name, dict()) controller = base.create_resource(collection_name, resource_name, plugin, params) ex = extensions.ResourceExtension(collection_name, controller) exts.append(ex) return exts
def get_resources(cls): """Returns Extended Resources.""" resources = [] net_template_inst = directory.get_plugin(constants.BSN_SERVICE_PLUGIN) plural_mappings = resource_helper.build_plural_mappings( {}, RESOURCE_ATTRIBUTE_MAP) for collection in RESOURCE_ATTRIBUTE_MAP: controller = base.create_resource( collection, plural_mappings[collection], net_template_inst, RESOURCE_ATTRIBUTE_MAP[collection]) resource = neutron_extensions.ResourceExtension( collection, controller) resources.append(resource) return resources
def get_resources(cls): """Returns Ext Resources.""" plugin = directory.get_plugin() collection_name = ADDRESS_SCOPES.replace('_', '-') params = RESOURCE_ATTRIBUTE_MAP.get(ADDRESS_SCOPES, dict()) controller = base.create_resource(collection_name, ADDRESS_SCOPE, plugin, params, allow_bulk=True, allow_pagination=True, allow_sorting=True) ex = extensions.ResourceExtension(collection_name, controller, attr_map=params) return [ex]
def get_resources(cls): """Returns Ext Resources.""" exts = [] plugin = manager.NeutronManager.get_service_plugins()[ nuage_constants.NUAGE_PORT_ATTRIBUTES_SERVICE_PLUGIN] resource_name = 'nuage_policy_group' collection_name = resource_name.replace('_', '-') + "s" params = RESOURCE_ATTRIBUTE_MAP.get(resource_name + "s", dict()) resource_registry.register_resource_by_name(resource_name) controller = base.create_resource(collection_name, resource_name, plugin, params, allow_bulk=True) ex = extensions.ResourceExtension(collection_name, controller) exts.append(ex) return exts
def get_resources(cls): """Returns Extended Resources.""" resources = [] q_mgr = manager.NeutronManager.get_instance() net_template_inst = q_mgr.get_service_plugins()['BSNSERVICEPLUGIN'] plural_mappings = resource_helper.build_plural_mappings( {}, RESOURCE_ATTRIBUTE_MAP) for collection in RESOURCE_ATTRIBUTE_MAP: controller = base.create_resource( collection, plural_mappings[collection], net_template_inst, RESOURCE_ATTRIBUTE_MAP[collection]) resource = extensions.ResourceExtension(collection, controller) resources.append(resource) return resources
def get_resources(cls): """Returns Extended Resources.""" exts = [] plugin = bc.get_plugin(constants.CISCO_N1KV_NET_PROFILE) resource_names = [NETWORK_PROFILE, NETWORK_PROFILE_BINDING] collection_names = [NETWORK_PROFILES, NETWORK_PROFILE_BINDINGS] for resource_name, collection_name in zip(resource_names, collection_names): controller = base.create_resource( collection_name, resource_name, plugin, RESOURCE_ATTRIBUTE_MAP.get(collection_name)) ex = extensions.ResourceExtension(collection_name, controller) exts.append(ex) return exts
def get_resources(cls): """Returns Extended Resource for service type management.""" my_plurals = [(key, key[:-1]) for key in RESOURCE_ATTRIBUTE_MAP.keys()] attributes.PLURALS.update(dict(my_plurals)) attr_map = RESOURCE_ATTRIBUTE_MAP[COLLECTION_NAME] collection_name = COLLECTION_NAME.replace('_', '-') controller = base.create_resource( collection_name, RESOURCE_NAME, servicetype_db.ServiceTypeManager.get_instance(), attr_map) return [ extensions.ResourceExtension(collection_name, controller, attr_map=attr_map) ]
def get_resources(cls): """Returns Ext Resources.""" exts = [] plugin = manager.NeutronManager.get_plugin() # vtep collection_name = VTEPS params = RESOURCE_ATTRIBUTE_MAP.get(collection_name, dict()) controller_host = base.create_resource(collection_name, VTEP, plugin, params) ex = extensions.ResourceExtension(collection_name, controller_host) exts.append(ex) # vtep binding parent = dict(member_name=VTEP, collection_name=VTEPS) collection_name = VTEP_BINDINGS params = RESOURCE_ATTRIBUTE_MAP.get(collection_name, dict()) controller_host = base.create_resource(collection_name, VTEP_BINDING, plugin, params, parent=parent) ex = extensions.ResourceExtension(collection_name, controller_host, parent) exts.append(ex) # vxlan binding parent = dict(member_name=VTEP, collection_name=VTEPS) collection_name = VXLANS params = RESOURCE_ATTRIBUTE_MAP.get(collection_name, dict()) controller_host = base.create_resource(collection_name, VXLAN, plugin, params, parent=parent) ex = extensions.ResourceExtension(collection_name, controller_host, parent) exts.append(ex) return exts