Example #1
0
def main():
    common_config.init(sys.argv[1:])

    common_config.setup_logging()
    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

    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)

    polling_interval = cfg.CONF.AGENT.polling_interval
    try:
        agent = SriovNicSwitchAgent(device_mappings,
                                    exclude_devices,
                                    polling_interval,
                                    rp_bandwidths,
                                    rp_inventory_defaults)
    except exc.SriovNicError:
        LOG.exception("Agent Initialization Failed")
        raise SystemExit(1)
    # Start everything.
    setup_profiler.setup("neutron-sriov-nic-agent", cfg.CONF.host)
    LOG.info("Agent initialized successfully, now running... ")
    agent.daemon_loop()
def main():
    eventlet.monkey_patch()
    cfg.CONF(project='neutron')

    # fix-neutron-agent-for-mtu-config hack
    cfg.CONF.register_opts(interface.OPTS)
    logging_config.setup_logging(cfg.CONF)
    LOG.info(_("network_device_mtu: %s"), str(cfg.CONF.network_device_mtu))
    try:
        interface_mappings = q_utils.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)

    polling_interval = cfg.CONF.AGENT.polling_interval
    root_helper = cfg.CONF.AGENT.root_helper
    agent = LinuxBridgeNeutronAgentRPC(interface_mappings,
                                       polling_interval,
                                       root_helper)
    LOG.info(_("Agent initialized successfully, now running... "))
    agent.daemon_loop()
    sys.exit(0)
def main():
    # this is from neutron.plugins.ml2.drivers.openvswitch.agent.main
    common_config.init(sys.argv[1:])
    n_utils.log_opt_values(LOG)
    common_config.setup_logging()
    # this is from neutron.plugins.ml2.drivers.openvswitch.agent.openflow.
    # ovs_ofctl.main
    bridge_classes = {
        'br_int': br_int.OVSIntegrationBridge,
        'br_phys': br_phys.OVSPhysicalBridge,
        'br_tun': br_tun.OVSTunnelBridge,
    }
    # this is from neutron.plugins.ml2.drivers.openvswitch.agent.
    # ovs_neutron_agent
    try:
        agent_config = create_agent_config_map(cfg.CONF)
    except ValueError:
        LOG.exception(_LE("Agent failed to create agent config map"))
        raise SystemExit(1)
    prepare_xen_compute()
    validate_local_ip(agent_config['local_ip'])
    try:
        agent = OVSBagpipeNeutronAgent(bridge_classes, **agent_config)
    except (RuntimeError, ValueError) as e:
        LOG.error(_LE("%s Agent terminated!"), e)
        sys.exit(1)
    agent.daemon_loop()
Example #4
0
def main():
    cfg.CONF.register_cli_opts(cli_opts)
    config.init(sys.argv[1:])

    # Enable logging but prevent output to stderr.
    cfg.CONF.use_stderr = False
    config.setup_logging()

    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!"))

    router.APIRouter.factory({})
    manager.init()

    gbp_plugin = directory.get_plugin('GROUP_POLICY')
    if not gbp_plugin:
        sys.exit("GBP service plugin not configured.")

    result = gbp_plugin.validate_state(cfg.CONF.repair)
    if result in [api.VALIDATION_FAILED_REPAIRABLE,
                  api.VALIDATION_FAILED_UNREPAIRABLE,
                  api.VALIDATION_FAILED_WITH_EXCEPTION]:
        sys.exit(result)
    return 0
Example #5
0
def main():
    eventlet.monkey_patch()
    cfg.CONF.register_opts(ip_lib.OPTS)
    cfg.CONF(project='neutron')
    logging_config.setup_logging(cfg.CONF)
    legacy.modernize_quantum_config(cfg.CONF)

    try:
        agent_config = create_agent_config_map(cfg.CONF)
    except ValueError as e:
        LOG.error(_('%s Agent terminated!'), e)
        sys.exit(1)

    is_xen_compute_host = 'rootwrap-xen-dom0' in agent_config['root_helper']
    if is_xen_compute_host:
        # Force ip_lib to always use the root helper to ensure that ip
        # commands target xen dom0 rather than domU.
        cfg.CONF.set_default('ip_lib_force_root', True)

    plugin = OVSNeutronAgent(**agent_config)

    # Start everything.
    LOG.info(_("Agent initialized successfully, now running... "))
    plugin.daemon_loop()
    sys.exit(0)
Example #6
0
def main():
    """Main method for cleaning up network namespaces.

    This method will make two passes checking for namespaces to delete. The
    process will identify candidates, sleep, and call garbage collect. The
    garbage collection will re-verify that the namespace meets the criteria for
    deletion (ie it is empty). The period of sleep and the 2nd pass allow
    time for the namespace state to settle, so that the check prior deletion
    will re-confirm the namespace is empty.

    The utility is designed to clean-up after the forced or unexpected
    termination of Neutron agents.

    The --force flag should only be used as part of the cleanup of a devstack
    installation as it will blindly purge namespaces and their devices. This
    option also kills any lingering DHCP instances.
    """
    conf = setup_conf()
    conf()
    config.setup_logging()

    root_helper = agent_config.get_root_helper(conf)
    # Identify namespaces that are candidates for deletion.
    candidates = [ns for ns in
                  ip_lib.IPWrapper.get_namespaces(root_helper)
                  if eligible_for_deletion(conf, ns, conf.force)]

    if candidates:
        eventlet.sleep(2)

        for namespace in candidates:
            destroy_namespace(conf, namespace, conf.force)
Example #7
0
def main():
    """Main method for cleaning up OVS bridges.

    The utility cleans up the integration bridges used by Neutron.
    """

    conf = setup_conf()
    conf()
    config.setup_logging()

    configuration_bridges = set([conf.ovs_integration_bridge,
                                 conf.external_network_bridge])
    ovs_bridges = set(ovs_lib.get_bridges(conf.AGENT.root_helper))
    available_configuration_bridges = configuration_bridges & ovs_bridges

    if conf.ovs_all_ports:
        bridges = ovs_bridges
    else:
        bridges = available_configuration_bridges

    # Collect existing ports created by Neutron on configuration bridges.
    # After deleting ports from OVS bridges, we cannot determine which
    # ports were created by Neutron, so port information is collected now.
    ports = collect_neutron_ports(available_configuration_bridges,
                                  conf.AGENT.root_helper)

    for bridge in bridges:
        LOG.info(_LI("Cleaning bridge: %s"), bridge)
        ovs = ovs_lib.OVSBridge(bridge, conf.AGENT.root_helper)
        ovs.delete_ports(all_ports=conf.ovs_all_ports)

    # Remove remaining ports created by Neutron (usually veth pair)
    delete_neutron_ports(ports, conf.AGENT.root_helper)

    LOG.info(_LI("OVS cleanup completed successfully"))
Example #8
0
def main():
    common_config.init(sys.argv[1:])
    common_config.setup_logging()
    q_utils.log_opt_values(LOG)
    bridge_classes = {
        'br_int': br_int.OVSIntegrationBridge,
        'br_phys': br_phys.OVSPhysicalBridge,
        'br_tun': br_tun.OVSTunnelBridge,
    }

    ovs_neutron_agent.prepare_xen_compute()
    ovs_neutron_agent.validate_tunnel_config(
        cfg.CONF.AGENT.tunnel_types,
        cfg.CONF.OVS.local_ip
    )

    try:
        agent = OVSSfcAgent(bridge_classes, cfg.CONF)
    except (RuntimeError, ValueError) as e:
        LOG.exception(e)
        LOG.error(_LE('Agent terminated!'))
        sys.exit(1)

    LOG.info(_LI("Agent initialized successfully, now running... "))
    agent.daemon_loop()
def main():
    common_config.init(sys.argv[1:])

    common_config.setup_logging()
    agent_config.setup_privsep()
    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,
                               LB_AGENT_BINARY)
    setup_profiler.setup("neutron-linuxbridge-agent", cfg.CONF.host)
    LOG.info("Agent initialized successfully, now running... ")
    launcher = service.launch(cfg.CONF, agent, restart_method='mutate')
    launcher.wait()
def main():
    cfg.CONF.register_opts(ip_lib.OPTS)
    config.register_root_helper(cfg.CONF)
    common_config.init(sys.argv[1:])
    common_config.setup_logging()
    q_utils.log_opt_values(LOG)
    bridge_classes = {
            'br_int': df_ovs_bridge.DFOVSAgentBridge,
            'br_phys': br_phys.OVSPhysicalBridge,
            'br_tun': br_tun.OVSTunnelBridge
                }
    try:
        agent_config = ona.create_agent_config_map(cfg.CONF)
    except ValueError as e:
        LOG.error(_LE('%s Agent terminated!'), e)
        sys.exit(1)

    is_xen_compute_host = 'rootwrap-xen-dom0' in cfg.CONF.AGENT.root_helper
    if is_xen_compute_host:
        # Force ip_lib to always use the root helper to ensure that ip
        # commands target xen dom0 rather than domU.
        cfg.CONF.set_default('ip_lib_force_root', True)

    agent = L2OVSControllerAgent(bridge_classes, **agent_config)

    signal.signal(signal.SIGTERM, agent._handle_sigterm)

    # Start everything.
    LOG.info(_LI("Agent initialized successfully, now running... "))
    agent.daemon_loop()
def main():
    common_config.init(sys.argv[1:])
    common_config.setup_logging()
    register_options()
    service.launch(config.CONF,
                   notification.NotificationService(),
                   config.CONF.infoblox.ipam_agent_workers).wait()
Example #12
0
def main():
    common_config.init(sys.argv[1:])

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

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

    manager = LinuxBridgeManager(bridge_mappings, 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_LINUXBRIDGE,
                               LB_AGENT_BINARY)
    LOG.info(_LI("Agent initialized successfully, now running... "))
    launcher = service.launch(cfg.CONF, agent)
    launcher.wait()
def main():
    common_config.init(sys.argv[1:])
    common_config.setup_logging()

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

    try:
        agent = mlnx_eswitch_neutron_agent.MlnxEswitchNeutronAgent(
            interface_mappings)
    except Exception as e:
        LOG.error(_LE("Failed on Agent initialisation : %s. "
                      "Agent terminated!"), e)
        sys.exit(1)

    # Start everything.
    LOG.info(_LI("Agent initialised successfully, now running... "))
    agent.run()
    sys.exit(0)
Example #14
0
def main():
    try:
        CONF(project='ryu', version='ofa_neutron_agent %s' % version,
             default_config_files=['/usr/local/etc/ryu/ryu.conf'])
    except cfg.ConfigFilesNotFoundError:
        CONF(project='ryu', version='ofa_neutron_agent %s' % version)

    osn_config.setup_logging(CONF)

    app_lists = CONF.app_lists + CONF.app
    if not app_lists:
        app_lists = ['neutron.plugins.ofagent.agent.ofa_neutron_agent']

    app_mgr = AppManager.get_instance()
    app_mgr.load_apps(app_lists)
    contexts = app_mgr.create_contexts()
    services = []
    services.extend(app_mgr.instantiate_apps(**contexts))

    webapp = wsgi.start_service(app_mgr)
    if webapp:
        thr = hub.spawn(webapp)
        services.append(thr)

    try:
        hub.joinall(services)
    finally:
        app_mgr.close()
Example #15
0
def main():
    common_config.init(sys.argv[1:])

    common_config.setup_logging()
    try:
        config_parser = SriovNicAgentConfigParser()
        config_parser.parse()
        device_mappings = config_parser.device_mappings
        exclude_devices = config_parser.exclude_devices

    except ValueError:
        LOG.exception(_LE("Failed on Agent configuration parse. "
                          "Agent terminated!"))
        raise SystemExit(1)
    LOG.info(_LI("Physical Devices mappings: %s"), device_mappings)
    LOG.info(_LI("Exclude Devices: %s"), exclude_devices)

    polling_interval = cfg.CONF.AGENT.polling_interval
    try:
        agent = SriovNicSwitchAgent(device_mappings,
                                    exclude_devices,
                                    polling_interval)
    except exc.SriovNicError:
        LOG.exception(_LE("Agent Initialization Failed"))
        raise SystemExit(1)
    # Start everything.
    LOG.info(_LI("Agent initialized successfully, now running... "))
    agent.daemon_loop()
def main():
    eventlet.monkey_patch()
    opts = [
        cfg.StrOpt('network_id'),
        cfg.StrOpt('router_id'),
        cfg.StrOpt('pid_file'),
        cfg.BoolOpt('daemonize', default=True),
        cfg.IntOpt('metadata_port',
                   default=9697,
                   help=_("TCP Port to listen for metadata server "
                          "requests.")),
    ]

    cfg.CONF.register_cli_opts(opts)
    # Don't get the default configuration file
    cfg.CONF(project='neutron', default_config_files=[])
    config.setup_logging(cfg.CONF)
    utils.log_opt_values(LOG)
    proxy = ProxyDaemon(cfg.CONF.pid_file,
                        cfg.CONF.metadata_port,
                        network_id=cfg.CONF.network_id,
                        router_id=cfg.CONF.router_id)

    if cfg.CONF.daemonize:
        proxy.start()
    else:
        proxy.run()
Example #17
0
def main():
    eventlet.monkey_patch()
    cfg.CONF(project='neutron')
    logging_config.setup_logging(cfg.CONF)

    try:
        interface_mappings = q_utils.parse_mappings(
            cfg.CONF.ESWITCH.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:
        agent = MlnxEswitchNeutronAgent(interface_mappings)
    except Exception as e:
        LOG.error(_("Failed on Agent initialisation : %s."
                    " Agent terminated!"), e)
        sys.exit(1)

    # Start everything.
    LOG.info(_("Agent initialised successfully, now running... "))
    agent.daemon_loop()
    sys.exit(0)
Example #18
0
def main():
    common_config.init(sys.argv[1:])

    common_config.setup_logging()

    integ_br = cfg.CONF.OVS.integration_bridge
    polling_interval = cfg.CONF.AGENT.polling_interval
    root_helper = cfg.CONF.AGENT.root_helper

    tunnel_ip = _get_tunnel_ip()
    LOG.debug(_('tunnel_ip %s'), tunnel_ip)
    ovsdb_port = cfg.CONF.OVS.ovsdb_port
    LOG.debug(_('ovsdb_port %s'), ovsdb_port)
    ovsdb_ip = _get_ovsdb_ip()
    LOG.debug(_('ovsdb_ip %s'), ovsdb_ip)
    try:
        agent = OVSNeutronOFPRyuAgent(integ_br, tunnel_ip, ovsdb_ip,
                                      ovsdb_port, polling_interval,
                                      root_helper)
    except httplib.HTTPException as e:
        LOG.error(_("Initialization failed: %s"), e)
        sys.exit(1)

    LOG.info(_("Ryu initialization on the node is done. "
               "Agent initialized successfully, now running..."))
    agent.daemon_loop()
    sys.exit(0)
def main():
    cfg.CONF.register_opts(ip_lib.OPTS)
    cfg.CONF.register_opts(dhcp_config.DHCP_OPTS)
    config.register_root_helper(cfg.CONF)
    common_config.init(sys.argv[1:])
    common_config.setup_logging()
    q_utils.log_opt_values(LOG)

    try:
        agent_config = create_agent_config_map(cfg.CONF)
    except ValueError as e:
        LOG.error(_('%s Agent terminated!'), e)
        sys.exit(1)

    is_xen_compute_host = 'rootwrap-xen-dom0' in cfg.CONF.AGENT.root_helper
    if is_xen_compute_host:
        # Force ip_lib to always use the root helper to ensure that ip
        # commands target xen dom0 rather than domU.
        cfg.CONF.set_default('ip_lib_force_root', True)
    try:
        agent = GBPOvsAgent(root_helper=cfg.CONF.AGENT.root_helper,
                            **agent_config)
    except RuntimeError as e:
        LOG.error(_("%s Agent terminated!"), e)
        sys.exit(1)
    signal.signal(signal.SIGTERM, agent._handle_sigterm)

    # Start everything.
    LOG.info(_("Agent initialized successfully, now running... "))
    agent.daemon_loop()
Example #20
0
def main():
    opts = [
        cfg.StrOpt("network_id", help=_("Network that will have instance metadata " "proxied.")),
        cfg.StrOpt("router_id", help=_("Router that will have connected instances' " "metadata proxied.")),
        cfg.StrOpt("pid_file", help=_("Location of pid file of this process.")),
        cfg.BoolOpt("daemonize", default=True, help=_("Run as daemon.")),
        cfg.IntOpt("metadata_port", default=9697, help=_("TCP Port to listen for metadata server " "requests.")),
        cfg.StrOpt(
            "metadata_proxy_socket",
            default="$state_path/metadata_proxy",
            help=_("Location of Metadata Proxy UNIX domain " "socket"),
        ),
    ]

    cfg.CONF.register_cli_opts(opts)
    # Don't get the default configuration file
    cfg.CONF(project="neutron", default_config_files=[])
    config.setup_logging()
    utils.log_opt_values(LOG)
    proxy = ProxyDaemon(
        cfg.CONF.pid_file, cfg.CONF.metadata_port, network_id=cfg.CONF.network_id, router_id=cfg.CONF.router_id
    )

    if cfg.CONF.daemonize:
        proxy.start()
    else:
        proxy.run()
Example #21
0
def main():

    
    cfg.CONF.register_opts(ip_lib.OPTS)
    common_config.init(sys.argv[1:])
    common_config.setup_logging()
    
           
    cfg.CONF.register_opts(ServiceChainAgent.OPTS,'servicechain')
    cfg.CONF.register_opts(ServiceChainAgent.agent_opts, "AGENT") 
    config.register_root_helper(cfg.CONF)   
    config.register_agent_state_opts_helper(cfg.CONF)

        
    
    
    cfg.CONF(project='neutron')

    try:
        agent_config = create_agent_config_map(cfg.CONF)
    except ValueError as e:
        LOG.error(_('%s ServiceChain-Agent terminated!'), e)
        sys.exit(1)

    plugin = ServiceChainAgent(**agent_config)
    signal.signal(signal.SIGTERM, plugin._handle_sigterm)

    # Start everything.
    LOG.info(_("ServiceChain-Agent initialized successfully, now running... "))
    plugin.daemon_loop()
    sys.exit(0)
def main():
    opts = [
        cfg.StrOpt('network_id',
                   help=_('Network that will have instance metadata '
                          'proxied.')),
        cfg.StrOpt('router_id',
                   help=_('Router that will have connected instances\' '
                          'metadata proxied.')),
        cfg.StrOpt('pid_file',
                   help=_('Location of pid file of this process.')),
        cfg.BoolOpt('daemonize',
                    default=False,
                    help=_('Run as daemon.')),
        cfg.StrOpt('metadata_host',
                   default="0.0.0.0",
                   help=_("IP address to listen for metadata server "
                          "requests.")),
        cfg.IntOpt('metadata_port',
                   default=9697,
                   help=_("TCP Port to listen for metadata server "
                          "requests.")),
        cfg.StrOpt('metadata_proxy_socket',
                   default='$state_path/metadata_proxy',
                   help=_('Location of Metadata Proxy UNIX domain '
                          'socket')),
        cfg.StrOpt('metadata_proxy_user',
                   default=None,
                   help=_("User (uid or name) running metadata proxy after "
                          "its initialization")),
        cfg.StrOpt('metadata_proxy_group',
                   default=None,
                   help=_("Group (gid or name) running metadata proxy after "
                          "its initialization")),
        cfg.BoolOpt('metadata_proxy_watch_log',
                    default=True,
                    help=_("Watch file log. Log watch should be disabled when "
                           "metadata_proxy_user/group has no read/write "
                           "permissions on metadata proxy log file.")),
    ]

    cfg.CONF.register_cli_opts(opts)
    # Don't get the default configuration file
    cfg.CONF(project='neutron', default_config_files=[])
    config.setup_logging()
    utils.log_opt_values(LOG)

    proxy = ProxyDaemon(cfg.CONF.pid_file,
                        cfg.CONF.metadata_port,
                        network_id=cfg.CONF.network_id,
                        router_id=cfg.CONF.router_id,
                        user=cfg.CONF.metadata_proxy_user,
                        group=cfg.CONF.metadata_proxy_group,
                        watch_log=cfg.CONF.metadata_proxy_watch_log,
                        host=cfg.CONF.metadata_host)

    if cfg.CONF.daemonize:
        proxy.start()
    else:
        proxy.run()
Example #23
0
def setup_test_logging(config_opts, log_dir, log_file_path_template):
    # Have each test log into its own log file
    config_opts.set_override("debug", True)
    fileutils.ensure_tree(log_dir, mode=0o755)
    log_file = sanitize_log_path(os.path.join(log_dir, log_file_path_template))
    config_opts.set_override("log_file", log_file)
    config_opts.set_override("use_stderr", False)
    config.setup_logging()
Example #24
0
def main():
    logging_config.init(sys.argv[1:])
    logging_config.setup_logging()

    polling_interval = cfg.CONF.AGENT.polling_interval
    agent = NECNWANeutronAgent(polling_interval)

    agent.daemon_loop()
Example #25
0
def _init_configuration():
    # the configuration will be read into the cfg.CONF global data structure
    config.init(sys.argv[1:])
    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!"))
Example #26
0
def main():
    eventlet.monkey_patch()
    cfg.CONF.register_opts(UnixDomainMetadataProxy.OPTS)
    cfg.CONF.register_opts(MetadataProxyHandler.OPTS)
    cfg.CONF(project='neutron')
    config.setup_logging(cfg.CONF)
    utils.log_opt_values(LOG)
    proxy = UnixDomainMetadataProxy(cfg.CONF)
    proxy.run()
Example #27
0
def _init_configuration():
    # the configuration will be read into the cfg.CONF global data structure
    config.init(sys.argv[1:])
    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!"))
Example #28
0
def main():
    common_config.init(sys.argv[1:])
    driver_name = cfg.CONF.OVS.of_interface
    mod_name = _main_modules[driver_name]
    mod = importutils.import_module(mod_name)
    mod.init_config()
    common_config.setup_logging()
    n_utils.log_opt_values(LOG)
    mod.main()
Example #29
0
def main():
    cfg.CONF(project='neutron')
    logging_config.setup_logging(cfg.CONF)

    plugin = HyperVNeutronAgent()

    # Start everything.
    LOG.info(_("Agent initialized successfully, now running... "))
    plugin.daemon_loop()
Example #30
0
def main():
    common_config.init(sys.argv[1:])
    # the following check is a transitional workaround to make this work
    # with different versions of ryu.
    # TODO(yamamoto) remove this later
    if ryu_cfg.CONF is not cfg.CONF:
        ryu_cfg.CONF(project='ryu', args=[])
    common_config.setup_logging()
    AppManager.run_apps(['neutron.plugins.ofagent.agent.ofa_neutron_agent'])
Example #31
0
def main():
    common_config.init(sys.argv[1:])
    common_config.setup_logging()
    server = neutron_service.Service.create(
        binary='neutron-fastpath-agent',
        topic="FP_AGENT",
        report_interval=30,
        manager='networking_6wind.agent.server.NeutronFastPathAgent')
    service.launch(cfg.CONF, server).wait()
Example #32
0
def main():
    common_config.init(sys.argv[1:])
    common_config.setup_logging()

    plugin = HyperVNeutronAgent()

    # Start everything.
    LOG.info(_LI("Agent initialized successfully, now running... "))
    plugin.daemon_loop()
Example #33
0
def main():
    config.init(sys.argv[1:])
    config.setup_logging()
    n_utils.log_opt_values(LOG)
    if not 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!"))
    run()
Example #34
0
def main():
    eventlet.monkey_patch()
    cfg.CONF.register_opts(UnixDomainMetadataProxy.OPTS)
    cfg.CONF.register_opts(MetadataProxyHandler.OPTS)
    cfg.CONF(project='neutron')
    config.setup_logging(cfg.CONF)
    utils.log_opt_values(LOG)
    proxy = UnixDomainMetadataProxy(cfg.CONF)
    proxy.run()
Example #35
0
def setup_test_logging(config_opts, log_dir, log_file_path_template):
    # Have each test log into its own log file
    config_opts.set_override('debug', True)
    utils.ensure_dir(log_dir)
    log_file = sanitize_log_path(
        os.path.join(log_dir, log_file_path_template))
    config_opts.set_override('log_file', log_file)
    config_opts.set_override('use_stderr', False)
    config.setup_logging()
Example #36
0
def main():
    common_config.init(sys.argv[1:])
    common_config.setup_logging(cfg.CONF)

    plugin = HyperVNeutronAgent()

    # Start everything.
    LOG.info(_("Agent initialized successfully, now running... "))
    plugin.daemon_loop()
def main():
    config.setup_logging()
    comm_utils.log_opt_values(LOG)
    cmd1 = ("ip netns exec %s conntrack -E -o timestamp") % (sys.argv[1])
    cmd2 = ("logger -p %s.%s -t opflex-conn-track") % (sys.argv[2],
                                                       sys.argv[3])
    LOG.debug("conn_track command: %s" % cmd1)
    LOG.debug("logger command: %s" % cmd2)
    wrapper = SnatConntrackLogger(cmd1, cmd2)
    return wrapper.wait()
Example #38
0
def main():
    """Main method for cleaning up OVS bridges.

    The utility cleans up the integration bridges used by Neutron.
    """

    conf = setup_conf()
    conf()
    config.setup_logging()
    do_main(conf)
def main():
    common_config.init(sys.argv[1:])
    common_config.setup_logging()
    # BGP dynamic route is not a service that needs real time response.
    # So disable pubsub here and use period task to do BGP job.
    cfg.CONF.set_override('enable_df_pub_sub', False, group='df')
    nb_api = api_nb.NbApi.get_instance(False)
    server = BGPService(nb_api)
    df_service.register_service('df-bgp-service', nb_api, server)
    service.launch(cfg.CONF, server).wait()
Example #40
0
def main():
    common_config.init(sys.argv[1:])
    common_config.setup_logging()
    cumulus_config.register_options()
    cumulus_agent = CumulusAgent()
    try:
        cumulus_agent.start()
    except Exception as e:
        LOG.exception(_LE("Error in Cumulus agent service."))
        sys.exit(_("ERROR: %s.") % e)
Example #41
0
def main():
    config.setup_logging()
    comm_utils.log_opt_values(LOG)
    command = ("ip netns exec %s conntrack -E -o timestamp 2>&1 | logger "
               "-p %s.%s -t opflex-conn-track") % (sys.argv[1], sys.argv[2],
                                                   sys.argv[3])
    LOG.debug("conn_track command: %s" % command)
    sh(command)

    return
Example #42
0
def _main():
    import sys
    common_config.init(sys.argv[1:])
    common_config.setup_logging()

    agent = DvsNeutronAgent()

    # Start everything.
    LOG.info(_LI("Agent initialized successfully, now running... "))
    agent.daemon_loop()
Example #43
0
def main():
    eventlet.monkey_patch()
    cfg.CONF(project='neutron')
    logging_config.setup_logging(cfg.CONF)

    plugin = HyperVNeutronAgent()

    # Start everything.
    LOG.info(_("Agent initialized successfully, now running... "))
    plugin.daemon_loop()
Example #44
0
def _init_configuration():
    # the configuration will be read into the cfg.CONF global data structure
    config.init(sys.argv[1:])  #初始化CONF,初始化rpc、notification、检验CONF.base_mac
    config.setup_logging()  #log相关
    config.set_config_defaults()  #wsgi_middleware  cors相关
    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():
    cfg.CONF(args=sys.argv[1:],
             default_config_files=['/etc/neutron/neutron.conf'])
    common_config.setup_logging()
    config.register_infoblox_ipam_opts(cfg.CONF)
    grid_id = cfg.CONF.infoblox.cloud_data_center_id
    config.register_infoblox_grid_opts(cfg.CONF, grid_id)

    create_ea_defs(grid_id)
    participate_network_views(grid_id)
def main():
    try:
        config.parse_power_config(sys.argv, 'powervc-neutron')
        logging_config.setup_logging(cfg.CONF)
        agent = RpcListener()
        agent.daemon_loop()
        sys.exit(0)
    except Exception:
        traceback.print_exc()
        raise
Example #47
0
def main():
    cfg.CONF.register_cli_opts(OPTS)
    cfg.CONF.set_override('use_stderr', True)
    config.setup_logging()
    config.init(sys.argv[1:], default_config_files=[])

    if cfg.CONF.config_file:
        enable_tests_from_config()

    return 0 if all_tests_passed() else 1
def main():
    # 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()
Example #49
0
def main():
    opts = [
        cfg.StrOpt('network_id',
                   help=_('Network that will have instance metadata '
                          'proxied.')),
        cfg.StrOpt('router_id',
                   help=_('Router that will have connected instances\' '
                          'metadata proxied.')),
        cfg.StrOpt('domain_id',
                   help=_('L3 domain that will have connected instances\' '
                          'metadata proxied.')),
        cfg.StrOpt('pid_file',
                   help=_('Location of pid file of this process.')),
        cfg.BoolOpt('daemonize', default=False, help=_('Run as daemon.')),
        cfg.StrOpt('metadata_host',
                   default="0.0.0.0",
                   help=_("IP address to listen for metadata server "
                          "requests.")),
        cfg.IntOpt('metadata_port',
                   default=9697,
                   help=_("TCP Port to listen for metadata server "
                          "requests.")),
        cfg.StrOpt('metadata_proxy_socket',
                   default='$state_path/metadata_proxy',
                   help=_('Location of Metadata Proxy UNIX domain '
                          'socket')),
        cfg.StrOpt('metadata_proxy_user',
                   default=None,
                   help=_("User (uid or name) running metadata proxy after "
                          "its initialization")),
        cfg.StrOpt('metadata_proxy_group',
                   default=None,
                   help=_("Group (gid or name) running metadata proxy after "
                          "its initialization")),
    ]

    cfg.CONF.register_cli_opts(opts)
    # Don't get the default configuration file
    cfg.CONF(project='neutron', default_config_files=[])
    config.setup_logging()
    utils.log_opt_values(LOG)

    proxy = ProxyDaemon(cfg.CONF.pid_file,
                        cfg.CONF.metadata_port,
                        network_id=cfg.CONF.network_id,
                        router_id=cfg.CONF.router_id,
                        domain_id=cfg.CONF.domain_id,
                        user=cfg.CONF.metadata_proxy_user,
                        group=cfg.CONF.metadata_proxy_group,
                        host=cfg.CONF.metadata_host)

    if cfg.CONF.daemonize:
        proxy.start()
    else:
        proxy.run()
Example #50
0
def main():
    cfg.CONF.register_opts(metadata_conf.UNIX_DOMAIN_METADATA_PROXY_OPTS)
    cfg.CONF.register_opts(metadata_conf.METADATA_PROXY_HANDLER_OPTS)
    cache.register_oslo_configs(cfg.CONF)
    cfg.CONF.set_default(name='cache_url', default='memory://?default_ttl=5')
    agent_conf.register_agent_state_opts_helper(cfg.CONF)
    config.init(sys.argv[1:])
    config.setup_logging()
    utils.log_opt_values(LOG)
    proxy = agent.UnixDomainMetadataProxy(cfg.CONF)
    proxy.run()
def main():
    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)
    config.init(sys.argv[1:])
    config.setup_logging()
    utils.log_opt_values(LOG)
    proxy = agent.UnixDomainMetadataProxy(cfg.CONF)
    proxy.run()
Example #52
0
def main():
    opts = [
        cfg.StrOpt('network_id',
                   help=_('Network that will have instance metadata '
                          'proxied.')),
        cfg.StrOpt('router_id',
                   help=_('Router that will have connected instances\' '
                          'metadata proxied.')),
        cfg.StrOpt('pid_file',
                   help=_('Location of pid file of this process.')),
        cfg.BoolOpt('daemonize',
                    default=True,
                    help=_('Run as daemon.')),
        cfg.IntOpt('metadata_port',
                   default=9697,
                   help=_("TCP Port to listen for metadata server "
                          "requests.")),
        cfg.StrOpt('metadata_proxy_socket',
                   default='$state_path/metadata_proxy',
                   help=_('Location of Metadata Proxy UNIX domain '
                          'socket')),
        cfg.StrOpt('metadata_proxy_user',
                   default=None,
                   help=_("User (uid or name) running metadata proxy after "
                          "its initialization")),
        cfg.StrOpt('metadata_proxy_group',
                   default=None,
                   help=_("Group (gid or name) running metadata proxy after "
                          "its initialization")),
        cfg.BoolOpt('metadata_proxy_watch_log',
                    default=True,
                    help=_("Watch file log. Log watch should be disabled when "
                           "metadata_proxy_user/group has no read/write "
                           "permissions on metadata proxy log file.")),
    ]

    cfg.CONF.register_cli_opts(opts)
    # Don't get the default configuration file
    cfg.CONF(project='neutron', default_config_files=[])
    config.setup_logging()
    utils.log_opt_values(LOG)

    proxy = ProxyDaemon(cfg.CONF.pid_file,
                        cfg.CONF.metadata_port,
                        network_id=cfg.CONF.network_id,
                        router_id=cfg.CONF.router_id,
                        user=cfg.CONF.metadata_proxy_user,
                        group=cfg.CONF.metadata_proxy_group,
                        watch_log=cfg.CONF.metadata_proxy_watch_log)

    if cfg.CONF.daemonize:
        proxy.start()
    else:
        proxy.run()
def main():
    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)
    meta.register_meta_conf_opts(meta.OVS_OPTS, group='ovs')
    config.init(sys.argv[1:])
    config.setup_logging()
    utils.log_opt_values(LOG)

    agt = agent.MetadataAgent(cfg.CONF)
    agt.start()
Example #54
0
    def create(cls, app_name='neutron'):

        # Setup logging early, supplying both the CLI options and the
        # configuration mapping from the config file
        # We only update the conf dict for the verbose and debug
        # flags. Everything else must be set up in the conf file...
        # Log the options used when starting if we're in debug mode...

        config.setup_logging()
        service = cls(app_name)
        return service
Example #55
0
def main():
    common_config.init(sys.argv[1:])
    common_config.setup_logging()

    integ_br = config.AGENT.integration_bridge
    polling_interval = config.AGENT.polling_interval
    agent = NVSDNeutronAgent(integ_br, polling_interval)
    LOG.info(_LI("NVSD Agent initialized successfully, now running... "))

    # Start everything.
    agent.daemon_loop()
Example #56
0
def main():
    cfg.CONF.register_opts(UnixDomainMetadataProxy.OPTS)
    cfg.CONF.register_opts(MetadataProxyHandler.OPTS)
    cache.register_oslo_configs(cfg.CONF)
    cfg.CONF.set_default(name='cache_url', default='memory://?default_ttl=5')
    agent_conf.register_agent_state_opts_helper(cfg.CONF)
    config.init(sys.argv[1:])
    config.setup_logging()
    utils.log_opt_values(LOG)
    proxy = UnixDomainMetadataProxy(cfg.CONF)
    proxy.run()
Example #57
0
def main():
    config.init(sys.argv[1:])
    config.setup_logging()
    pl_config.register_config()

    integ_br = cfg.CONF.RESTPROXYAGENT.integration_bridge
    polling_interval = cfg.CONF.RESTPROXYAGENT.polling_interval
    bsnagent = RestProxyAgent(integ_br, polling_interval,
                              cfg.CONF.RESTPROXYAGENT.virtual_switch_type)
    bsnagent.daemon_loop()
    sys.exit(0)
Example #58
0
def main():
    common_config.init(sys.argv[1:])
    # driver_name = ovs-ofctl
    driver_name = cfg.CONF.OVS.of_interface
    mod_name = _main_modules[driver_name]
    mod = importutils.import_module(mod_name)
    mod.init_config()
    common_config.setup_logging()
    n_utils.log_opt_values(LOG)
    profiler.setup("neutron-ovs-agent", cfg.CONF.host)
    # 调用ovs-ofctl对应的main方法
    mod.main()
def main():
    eventlet.monkey_patch()
    cfg.CONF(project='neutron')
    common_config.init(sys.argv[1:])
    common_config.setup_logging()

    agent = zvmNeutronAgent()

    # Start to query xCAT DB
    LOG.info("z/VM agent initialized, now running... ")
    agent.xcatdb_daemon_loop()
    sys.exit(0)
Example #60
0
def main():
    config.init(sys.argv[1:])
    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!"))
    config.setup_logging()

    public_network_id = "00000000-0000-0000-0000-000000000000"
    ip_availability = get_ip_availability(network_id=public_network_id,
                                          ip_version=4)
    print(json.dumps(ip_availability))