

def initialize_all():
    ext_mgr = extensions.PluginAwareExtensionManager.get_instance()
    ext_mgr.extend_resources('2.0', attributes.RESOURCE_ATTRIBUTE_MAP)
    pecanized_exts = [ext for ext in ext_mgr.extensions.values() if hasattr(ext, 'get_pecan_controllers')]
    non_pecanized_exts = (set(ext_mgr.extensions.values()) - set(pecanized_exts))
    pecan_controllers = {
        
    }
    for ext in pecanized_exts:
        LOG.info(_LI('Extension %s is pecan-aware. Fetching resources and controllers'), ext.get_name())
        controllers = ext.get_pecan_controllers()
        for (collection, coll_controller) in controllers:
            pecan_controllers[collection] = coll_controller
    for collection in attributes.RESOURCE_ATTRIBUTE_MAP:
        resource = _handle_plurals(collection)
        plugin = _plugin_for_resource(collection)
        if plugin:
            manager.NeutronManager.set_plugin_for_resource(resource, plugin)
        else:
            LOG.warning(_LW('No plugin found for resource:%s. API calls may not be correctly dispatched'), resource)
        controller = pecan_controllers.get(collection)
        if (not controller):
            LOG.debug('Building controller for resource:%s', resource)
            controller = res_ctrl.CollectionsController(collection, resource)
        else:
            LOG.debug('There are already controllers for resource: %s', resource)
        manager.NeutronManager.set_controller_for_resource(controller.collection, controller)
        LOG.info(_LI('Added controller for resource %(resource)s via URI path segment:%(collection)s'), {
            'resource': resource,
            'collection': collection,
        })
    initialize_legacy_extensions(non_pecanized_exts)
    for resource in router.RESOURCES.keys():
        resource_registry.register_resource_by_name(resource)
    for ext in ext_mgr.extensions.values():
        if hasattr(ext, 'get_resources'):
            ext.get_resources()
        if hasattr(ext, 'get_extended_resources'):
            ext.get_extended_resources('v2.0')
    policy.reset()

dataset/ETHPy150Open openstack/neutron/neutron/pecan_wsgi/startup.py initialize_all/original