Example #1
0
 def test_init(self):
     napisdn_ctxt = context.NeutronApiSDNContext()
     self.assertEquals(napisdn_ctxt.interfaces,
                       ['neutron-plugin-api-subordinate'])
     self.assertEquals(napisdn_ctxt.services, ['neutron-api'])
     self.assertEquals(napisdn_ctxt.config_file,
                       '/etc/neutron/neutron.conf')
Example #2
0
 def ctxt_check(self, rel_settings, expect, _rids, _runits, _rget, _log):
     self.test_relation.set(rel_settings)
     _runits.return_value = ['unit1']
     _rids.return_value = ['rid2']
     _rget.side_effect = self.test_relation.get
     self.relation_ids.return_value = ['rid2']
     self.related_units.return_value = ['unit1']
     napisdn_ctxt = context.NeutronApiSDNContext()()
     self.assertEquals(napisdn_ctxt, expect)
Example #3
0
def resource_map(release=None):
    '''
    Dynamically generate a map of resources that will be managed for a single
    hook execution.
    '''
    release = release or os_release('neutron-common')

    resource_map = deepcopy(BASE_RESOURCE_MAP)
    if CompareOpenStackReleases(release) >= 'liberty':
        resource_map.update(LIBERTY_RESOURCE_MAP)

    if os.path.exists('/etc/apache2/conf-available'):
        resource_map.pop(APACHE_CONF)
    else:
        resource_map.pop(APACHE_24_CONF)

    if manage_plugin():
        # add neutron plugin requirements. nova-c-c only needs the
        # neutron-server associated with configs, not the plugin agent.
        plugin = config('neutron-plugin')
        conf = neutron_plugin_attribute(plugin, 'config', 'neutron')
        ctxts = (neutron_plugin_attribute(plugin, 'contexts', 'neutron') or [])
        services = neutron_plugin_attribute(plugin, 'server_services',
                                            'neutron')
        resource_map[conf] = {}
        resource_map[conf]['services'] = services
        resource_map[conf]['contexts'] = ctxts
        resource_map[conf]['contexts'].append(
            neutron_api_context.NeutronCCContext())

        if ('kilo' <= CompareOpenStackReleases(release) <= 'mitaka'
                and config('enable-sriov')):
            resource_map[ML2_SRIOV_INI] = {}
            resource_map[ML2_SRIOV_INI]['services'] = services
            resource_map[ML2_SRIOV_INI]['contexts'] = []
        if (config('enable-arista')):
            resource_map[NEUTRON_DEFAULT]['contexts'] = \
                [neutron_api_context.NeutronApiSDNConfigFileContext()]
    else:
        resource_map[NEUTRON_CONF]['contexts'].append(
            neutron_api_context.NeutronApiSDNContext())
        resource_map[NEUTRON_DEFAULT]['contexts'] = \
            [neutron_api_context.NeutronApiSDNConfigFileContext()]
    if enable_memcache(release=release):
        resource_map[MEMCACHED_CONF] = {
            'contexts': [context.MemcacheContext()],
            'services': ['memcached']
        }

    return resource_map
Example #4
0
def resource_map(release=None):
    '''
    Dynamically generate a map of resources that will be managed for a single
    hook execution.
    '''
    release = release or os_release('neutron-common')

    resource_map = deepcopy(BASE_RESOURCE_MAP)
    if release >= 'liberty':
        resource_map.update(LIBERTY_RESOURCE_MAP)

    if os.path.exists('/etc/apache2/conf-available'):
        resource_map.pop(APACHE_CONF)
    else:
        resource_map.pop(APACHE_24_CONF)

    if manage_plugin():
        # add neutron plugin requirements. nova-c-c only needs the
        # neutron-server associated with configs, not the plugin agent.
        plugin = config('neutron-plugin')
        conf = neutron_plugin_attribute(plugin, 'config', 'neutron')
        ctxts = (neutron_plugin_attribute(plugin, 'contexts', 'neutron') or
                 [])
        services = neutron_plugin_attribute(plugin, 'server_services',
                                            'neutron')
        resource_map[conf] = {}
        resource_map[conf]['services'] = services
        resource_map[conf]['contexts'] = ctxts
        resource_map[conf]['contexts'].append(
            neutron_api_context.NeutronCCContext())

        # update for postgres
        resource_map[conf]['contexts'].append(
            context.PostgresqlDBContext(database=config('database')))

    else:
        resource_map[NEUTRON_CONF]['contexts'].append(
            neutron_api_context.NeutronApiSDNContext()
        )
        resource_map[NEUTRON_DEFAULT]['contexts'] = \
            [neutron_api_context.NeutronApiSDNConfigFileContext()]
    return resource_map
def resource_map(release=None):
    '''
    Dynamically generate a map of resources that will be managed for a single
    hook execution.
    '''
    release = release or os_release('neutron-common')

    resource_map = deepcopy(BASE_RESOURCE_MAP)
    if CompareOpenStackReleases(release) >= 'liberty':
        resource_map.update(LIBERTY_RESOURCE_MAP)

    if CompareOpenStackReleases(release) >= 'train':
        resource_map.pop(NEUTRON_LBAAS_CONF)

    if os.path.exists('/etc/apache2/conf-available'):
        resource_map.pop(APACHE_CONF)
    else:
        resource_map.pop(APACHE_24_CONF)

    if manage_plugin():
        # add neutron plugin requirements. nova-c-c only needs the
        # neutron-server associated with configs, not the plugin agent.
        plugin = config('neutron-plugin')
        conf = neutron_plugin_attribute(plugin, 'config', 'neutron')
        ctxts = (neutron_plugin_attribute(plugin, 'contexts', 'neutron') or
                 [])
        services = neutron_plugin_attribute(plugin, 'server_services',
                                            'neutron')
        resource_map[conf] = {}
        resource_map[conf]['services'] = services
        resource_map[conf]['contexts'] = ctxts
        resource_map[conf]['contexts'].append(
            neutron_api_context.NeutronCCContext())

        if ('kilo' <= CompareOpenStackReleases(release) <= 'mitaka' and
                config('enable-sriov')):
            resource_map[ML2_SRIOV_INI] = {}
            resource_map[ML2_SRIOV_INI]['services'] = services
            resource_map[ML2_SRIOV_INI]['contexts'] = []
    else:
        plugin_ctxt_instance = neutron_api_context.NeutronApiSDNContext()
        if (plugin_ctxt_instance.is_default('core_plugin') and
                plugin_ctxt_instance.is_default('neutron_plugin_config')):
            # The default core plugin is ML2.  If the driver provided by plugin
            # subordinate is built on top of ML2, the subordinate will have use
            # for influencing existing template variables as well as injecting
            # sections into the ML2 configuration file.
            conf = neutron_plugin_attribute('ovs', 'config', 'neutron')
            services = neutron_plugin_attribute('ovs', 'server_services',
                                                'neutron')
            if conf not in resource_map:
                resource_map[conf] = {}
                resource_map[conf]['services'] = services
                resource_map[conf]['contexts'] = [
                    neutron_api_context.NeutronCCContext(),
                ]
            resource_map[conf]['contexts'].append(
                neutron_api_context.NeutronApiSDNContext(
                    config_file=conf)
            )

        resource_map[NEUTRON_CONF]['contexts'].append(
            plugin_ctxt_instance,
        )
        resource_map[NEUTRON_DEFAULT]['contexts'] = \
            [neutron_api_context.NeutronApiSDNConfigFileContext()]
    if enable_memcache(release=release):
        resource_map[MEMCACHED_CONF] = {
            'contexts': [context.MemcacheContext()],
            'services': ['memcached']}

    return resource_map