示例#1
0
def main():
    common_config.register_common_config_options()
    common_config.init(sys.argv[1:])
    of_main.init_config()
    common_config.setup_logging()
    profiler.setup("neutron-ovs-agent", cfg.CONF.host)
    of_main.main()
示例#2
0
def main():
    common_config.register_common_config_options()
    common_config.init(sys.argv[1:])
    ovs_conf.register_ovs_agent_opts()
    common_config.setup_logging()
    agent_config.setup_privsep()
    port_cleaner = PatchPortCleaner(cfg.CONF)
    port_cleaner.destroy_patch_ports()
def configure(conf):
    config.register_common_config_options()
    config.init(sys.argv[1:])
    conf.set_override('log_dir', cfg.CONF.conf_dir)
    conf.set_override('debug', True)
    conf.set_override('use_syslog', True)
    config.setup_logging()
    privileged.default.set_client_mode(False)
示例#4
0
    def setUp(self):
        config.register_common_config_options()
        super(_TestModelsMigrations, self).setUp()
        self.cfg = self.useFixture(config_fixture.Config())
        self.cfg.config(core_plugin='ml2')
        self.alembic_config = migration.get_neutron_config()
        self.alembic_config.neutron_config = cfg.CONF

        # Migration tests can take a long time
        self.useFixture(test_base.Timeout(scaling=self.TIMEOUT_SCALING_FACTOR))
示例#5
0
def setup_conf():
    config.register_common_config_options()
    ovs_conf.register_ovs_agent_opts(cfg.CONF)
    lb_conf.register_linuxbridge_opts(cfg.CONF)
    sriov_conf.register_agent_sriov_nic_opts(cfg.CONF)
    ml2_conf.register_ml2_plugin_opts(cfg.CONF)
    securitygroups_rpc.register_securitygroups_opts(cfg.CONF)
    dhcp_agent.register_options(cfg.CONF)
    l3_hamode_db.register_db_l3_hamode_opts(cfg.CONF)
    common_config.register_core_common_config_opts(cfg.CONF)
示例#6
0
def register_options(conf):
    common_config.register_common_config_options()
    config.register_interface_driver_opts_helper(conf)
    config.register_agent_state_opts_helper(conf)
    config.register_availability_zone_opts_helper(conf)
    dhcp_config.register_agent_dhcp_opts(conf)
    meta_conf.register_meta_conf_opts(meta_conf.SHARED_OPTS, conf)
    config.register_interface_opts(conf)
    config.register_root_helper(conf)
    ovs_conf.register_ovs_opts(conf)
示例#7
0
def main():
    # TODO(slaweq): this monkepatch will not be necessary when
    # https://review.opendev.org/#/c/506722/ will be merged and ovsdb-server
    # ovs-vswitchd processes for each test will be isolated in separate
    # namespace
    config.register_common_config_options()
    monkeypatch_init_handler()
    monkeypatch_qos()
    monkeypatch_event_filtering()
    ovs_agent.main()
示例#8
0
def _init_configuration():
    # the configuration will be read into the cfg.CONF global data structure
    conf_files = _get_config_files()
    config.register_common_config_options()
    config.init(sys.argv[1:], default_config_files=conf_files)
    config.setup_logging()
    config.set_config_defaults()
    if not cfg.CONF.config_file:
        sys.exit(_("ERROR: Unable to find configuration file via the default"
                   " search paths (~/.neutron/, ~/, /etc/neutron/, /etc/) and"
                   " the '--config-file' option!"))
def main():
    common_config.register_common_config_options()
    # TODO(hjensas): Imports from neutron in ironic_neutron_agent registers the
    # client options. We need to unregister the options we are deprecating
    # first to avoid DuplicateOptError. Remove this when dropping deprecations.
    _unregiser_deprecated_opts()
    common_config.init(sys.argv[1:])
    common_config.setup_logging()
    agent = BaremetalNeutronAgent()
    launcher = service.launch(cfg.CONF, agent, restart_method='mutate')
    launcher.wait()
示例#10
0
def setup_conf(conf=cfg.CONF):
    """Setup the cfg for the status check utility.

    Use separate setup_conf for the utility because there are many options
    from the main config that do not apply during checks.
    """
    common_config.register_common_config_options()
    neutron_conf_base.register_core_common_config_opts(conf)
    neutron_conf_service.register_service_opts(
        neutron_conf_service.SERVICE_OPTS, cfg.CONF)
    db_options.set_defaults(conf)
    return conf
示例#11
0
def setup_conf():
    """Setup the cfg for the clean up utility.

    Use separate setup_conf for the utility because there are many options
    from the main config that do not apply during clean-up.
    """
    conf = cfg.CONF
    config.register_common_config_options()
    agent_config.register_root_helper(conf=conf)
    agent_config.setup_privsep()
    command.register_cmd_opts(command.ip_opts, conf)
    return conf
示例#12
0
def register_opts(conf):
    common_config.register_common_config_options()
    l3_config.register_l3_agent_config_opts(l3_config.OPTS, conf)
    ha_conf.register_l3_agent_ha_opts(conf)
    meta_conf.register_meta_conf_opts(meta_conf.SHARED_OPTS, conf)
    config.register_interface_driver_opts_helper(conf)
    config.register_agent_state_opts_helper(conf)
    config.register_interface_opts(conf)
    config.register_external_process_opts(conf)
    config.register_pddriver_opts(conf)
    config.register_ra_opts(conf)
    config.register_availability_zone_opts_helper(conf)
    ovs_conf.register_ovs_opts(conf)
示例#13
0
def setup_conf():
    """Setup the cfg for the clean up utility.

    Use separate setup_conf for the utility because there are many options
    from the main config that do not apply during clean-up.
    """

    conf = cfg.CONF
    config.register_common_config_options()
    cmd.register_cmd_opts(cmd.netns_opts, conf)
    agent_config.register_interface_driver_opts_helper(conf)
    dhcp_config.register_agent_dhcp_opts(conf)
    agent_config.register_interface_opts()
    return conf
示例#14
0
def main():
    config.register_common_config_options()
    meta.register_meta_conf_opts(meta.SHARED_OPTS)
    meta.register_meta_conf_opts(meta.UNIX_DOMAIN_METADATA_PROXY_OPTS)
    meta.register_meta_conf_opts(meta.METADATA_PROXY_HANDLER_OPTS)
    cache.register_oslo_configs(cfg.CONF)
    agent_conf.register_agent_state_opts_helper(cfg.CONF)
    service_conf.register_service_opts(service_conf.RPC_EXTRA_OPTS, cfg.CONF)

    config.init(sys.argv[1:])
    config.setup_logging()
    utils.log_opt_values(LOG)
    proxy = agent.UnixDomainMetadataProxy(cfg.CONF)
    proxy.run()
示例#15
0
def main():
    config.register_common_config_options()
    ovn_conf.register_opts()
    ovn_meta.register_meta_conf_opts(meta.SHARED_OPTS)
    ovn_meta.register_meta_conf_opts(meta.UNIX_DOMAIN_METADATA_PROXY_OPTS)
    ovn_meta.register_meta_conf_opts(meta.METADATA_PROXY_HANDLER_OPTS)
    ovn_meta.register_meta_conf_opts(ovn_meta.OVS_OPTS, group='ovs')
    config.init(sys.argv[1:])
    config.setup_logging()
    ovn_meta.setup_privsep()
    utils.log_opt_values(LOG)

    agt = agent.MetadataAgent(cfg.CONF)
    agt.start()
示例#16
0
def main():
    """Main method for cleaning up empty linux bridges.

    This tool deletes every empty linux bridge managed by linuxbridge agent
    (brq.* linux bridges) except thes ones defined using bridge_mappings option
    in section LINUX_BRIDGE (created by deployers).

    This tool should not be called during an instance create, migrate, etc. as
    it can delete a linux bridge about to be used by nova.
    """
    common_config.register_common_config_options()
    cfg.CONF(sys.argv[1:])
    config.setup_logging()
    config.setup_privsep()
    remove_empty_bridges()
示例#17
0
def main():
    conf = cfg.CONF
    common_config.register_common_config_options()
    metering_agent.register_metering_agent_opts()
    config.register_agent_state_opts_helper(conf)
    common_config.init(sys.argv[1:])
    config.setup_logging()
    config.setup_privsep()
    server = neutron_service.Service.create(
        binary=constants.AGENT_PROCESS_METERING,
        topic=topics.METERING_AGENT,
        report_interval=cfg.CONF.AGENT.report_interval,
        manager='neutron.services.metering.agents.'
        'metering_agent.MeteringAgentWithStateReport')
    service.launch(cfg.CONF, server, restart_method='mutate').wait()
示例#18
0
def main():
    common_config.register_common_config_options()
    # Interpret the config file for Python logging.
    # This line sets up loggers basically.
    logging_config.fileConfig(neutron_alembic_ini)

    CONF(project='neutron')
    return_val = False
    for config in get_alembic_configs():
        # TODO(gongysh) enable logging
        return_val |= bool(CONF.command.func(config, CONF.command.name))

    if CONF.command.name == 'has_offline_migrations' and not return_val:
        log_info(_('No offline migrations pending.'))

    return return_val
示例#19
0
def main():
    common_config.register_common_config_options()
    common_config.init(sys.argv[1:])

    common_config.setup_logging()
    agent_config.setup_privsep()
    service_conf.register_service_opts(service_conf.RPC_EXTRA_OPTS, cfg.CONF)

    try:
        config_parser = SriovNicAgentConfigParser()
        config_parser.parse()
        device_mappings = config_parser.device_mappings
        exclude_devices = config_parser.exclude_devices
        rp_bandwidths = config_parser.rp_bandwidths
        rp_inventory_defaults = config_parser.rp_inventory_defaults
        rp_hypervisors = config_parser.rp_hypervisors

    except ValueError:
        LOG.exception("Failed on Agent configuration parse. "
                      "Agent terminated!")
        raise SystemExit(1)
    LOG.info("Physical Devices mappings: %s", device_mappings)
    LOG.info("Exclude Devices: %s", exclude_devices)
    LOG.info("Resource provider bandwidths: %s", rp_bandwidths)
    LOG.info("Resource provider inventory defaults: %s", rp_inventory_defaults)
    LOG.info("Resource provider hypervisors: %s", rp_hypervisors)

    polling_interval = cfg.CONF.AGENT.polling_interval
    try:
        agent = SriovNicSwitchAgent(device_mappings,
                                    exclude_devices,
                                    polling_interval,
                                    rp_bandwidths,
                                    rp_inventory_defaults,
                                    rp_hypervisors)
    except exc.SriovNicError:
        LOG.exception("Agent Initialization Failed")
        raise SystemExit(1)
    # Start everything.
    setup_profiler.setup(n_constants.AGENT_PROCESS_NIC_SWITCH, cfg.CONF.host)
    LOG.info("Agent initialized successfully, now running... ")
    agent.daemon_loop()
示例#20
0
def main():
    common_config.register_common_config_options()
    common_config.init(sys.argv[1:])

    common_config.setup_logging()
    agent_config.setup_privsep()

    validate_firewall_driver()
    interface_mappings = parse_interface_mappings()

    manager = MacvtapManager(interface_mappings)

    polling_interval = cfg.CONF.AGENT.polling_interval
    quitting_rpc_timeout = cfg.CONF.AGENT.quitting_rpc_timeout
    agent = ca.CommonAgentLoop(manager, polling_interval, quitting_rpc_timeout,
                               constants.AGENT_TYPE_MACVTAP,
                               constants.AGENT_PROCESS_MACVTAP)
    LOG.info("Agent initialized successfully, now running... ")
    launcher = service.launch(cfg.CONF, agent, restart_method='mutate')
    launcher.wait()
示例#21
0
def main():
    config.register_common_config_options()
    config.init(sys.argv[1:])
    config.setup_logging()

    cxt = context.get_admin_context()
    manager.init()
    plugin = directory.get_plugin()
    l3_plugin = directory.get_plugin(constants.L3)
    notifier = n_rpc.get_notifier('network')
    for network in plugin.get_networks(cxt):
        notifier.info(cxt, 'network.exists', {'network': network})
    for subnet in plugin.get_subnets(cxt):
        notifier.info(cxt, 'subnet.exists', {'subnet': subnet})
    for port in plugin.get_ports(cxt):
        notifier.info(cxt, 'port.exists', {'port': port})
    for router in l3_plugin.get_routers(cxt):
        notifier.info(cxt, 'router.exists', {'router': router})
    for floatingip in l3_plugin.get_floatingips(cxt):
        notifier.info(cxt, 'floatingip.exists', {'floatingip': floatingip})
示例#22
0
文件: base.py 项目: stackhpc/neutron
    def setUp(self):
        super(BaseTestCase, self).setUp()

        self.useFixture(lockutils.ExternalLockFixture())
        self.useFixture(fixture.APIDefinitionFixture())

        config.register_common_config_options()
        cfg.CONF.set_override('state_path', self.get_default_temp_dir().path)

        self.addCleanup(CONF.reset)
        self.useFixture(ProcessMonitorFixture())

        self.useFixture(
            fixtures.MonkeyPatch(
                'neutron_lib.exceptions.NeutronException.use_fatal_exceptions',
                fake_use_fatal_exceptions))

        self.useFixture(
            fixtures.MonkeyPatch(
                'oslo_config.cfg.find_config_files',
                lambda project=None, prog=None, extension=None: []))

        self.useFixture(fixture.RPCFixture())

        self.setup_config()

        self._callback_manager = registry_manager.CallbacksManager()
        self.useFixture(
            fixture.CallbackRegistryFixture(
                callback_manager=self._callback_manager))
        # Give a private copy of the directory to each test.
        self.useFixture(fixture.PluginDirectoryFixture())

        policy.init(suppress_deprecation_warnings=True)
        self.addCleanup(policy.reset)
        self.addCleanup(resource_registry.unregister_all_resources)
        self.addCleanup(db_api.sqla_remove_all)
        self.addCleanup(rpc_consumer_reg.clear)
        self.addCleanup(rpc_producer_reg.clear)
        self.addCleanup(profiler.clean)
def main():
    common_config.register_common_config_options()
    common_config.init(sys.argv[1:])

    common_config.setup_logging()
    agent_config.setup_privsep()
    service_conf.register_service_opts(service_conf.RPC_EXTRA_OPTS, cfg.CONF)

    try:
        interface_mappings = helpers.parse_mappings(
            cfg.CONF.LINUX_BRIDGE.physical_interface_mappings)
    except ValueError as e:
        LOG.error(
            "Parsing physical_interface_mappings failed: %s. "
            "Agent terminated!", e)
        sys.exit(1)
    LOG.info("Interface mappings: %s", interface_mappings)

    try:
        bridge_mappings = helpers.parse_mappings(
            cfg.CONF.LINUX_BRIDGE.bridge_mappings)
    except ValueError as e:
        LOG.error("Parsing bridge_mappings failed: %s. "
                  "Agent terminated!", e)
        sys.exit(1)
    LOG.info("Bridge mappings: %s", bridge_mappings)

    manager = LinuxBridgeManager(bridge_mappings, interface_mappings)
    linuxbridge_capabilities.register()

    polling_interval = cfg.CONF.AGENT.polling_interval
    quitting_rpc_timeout = cfg.CONF.AGENT.quitting_rpc_timeout
    agent = ca.CommonAgentLoop(manager, polling_interval, quitting_rpc_timeout,
                               constants.AGENT_TYPE_LINUXBRIDGE,
                               constants.AGENT_PROCESS_LINUXBRIDGE)
    setup_profiler.setup(constants.AGENT_PROCESS_LINUXBRIDGE, cfg.CONF.host)
    LOG.info("Agent initialized successfully, now running... ")
    launcher = service.launch(cfg.CONF, agent, restart_method='mutate')
    launcher.wait()
示例#24
0
from neutron.common import config as common_config

from neutron_lib.api.definitions import bgpvpn as bgpvpn_api_def
from neutron_lib.api import extensions as api_extensions
from neutron_lib import exceptions as n_exc
from neutron_lib.plugins import directory
from neutron_lib.services import base as libbase

from oslo_log import log

from networking_bgpvpn._i18n import _
from networking_bgpvpn.neutron import extensions as bgpvpn_extensions

LOG = log.getLogger(__name__)

common_config.register_common_config_options()
extensions.append_api_extensions_path(bgpvpn_extensions.__path__)


class BGPVPNNotFound(n_exc.NotFound):
    message = _("BGPVPN %(id)s could not be found")


class BGPVPNNetAssocNotFound(n_exc.NotFound):
    message = _("BGPVPN network association %(id)s could not be found "
                "for BGPVPN %(bgpvpn_id)s")


class BGPVPNRouterAssocNotFound(n_exc.NotFound):
    message = _("BGPVPN router association %(id)s could not be found "
                "for BGPVPN %(bgpvpn_id)s")
def setup_conf():
    conf = cfg.CONF
    common_config.register_common_config_options()
    db_group, neutron_db_opts = db_options.list_opts()[0]
    cfg.CONF.register_cli_opts(neutron_db_opts, db_group)
    conf()
示例#26
0
def main():
    config.register_common_config_options()
    cfg.CONF.register_opts(OPTS)
    monkeypatch_linux_dhcp()
    dhcp_agent.main()