示例#1
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)
示例#2
0
    def setUp(self):
        super(TestBase, self).setUp()
        tox_path = os.environ.get("VIRTUAL_ENV")
        cfg.CONF.set_override('state_path', tox_path)

        neutron_conf_path = "%s/etc/neutron/neutron.conf" % tox_path
        try:
            open(neutron_conf_path, "r")
        except IOError:
            open(neutron_conf_path, "w")

        args = ['--config-file', neutron_conf_path]
        config.init(args=args)

        self.context = context.Context('fake', 'fake', is_admin=False)
        self.admin_context = context.Context('fake', 'fake', is_admin=True)

        class FakeContext(object):
            def __new__(cls, *args, **kwargs):
                return super(FakeContext, cls).__new__(cls)

            def __enter__(*args, **kwargs):
                pass

            def __exit__(*args, **kwargs):
                pass

        self.context.session.begin = FakeContext
示例#3
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():
    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()
示例#5
0
def main():
    register_options(cfg.CONF)
    calico_config.register_options(cfg.CONF)
    common_config.init(sys.argv[1:])
    setup_logging()
    agent = CalicoDhcpAgent()
    agent.run()
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()
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()
示例#8
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()
示例#9
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():
    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()
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)
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()
示例#13
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)
示例#14
0
def main():
    cfg.CONF.register_opts(common_params.df_opts, 'df')
    common_config.init(sys.argv[1:])
    config.setup_logging()
    service = PublisherService()
    service.initialize()
    service.run()
示例#15
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
示例#16
0
def main():
    # the configuration will be read into the cfg.CONF global data structure
    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!"))
    try:
        pool = eventlet.GreenPool()

        neutron_api = service.serve_wsgi(service.NeutronApiService)
        api_thread = pool.spawn(neutron_api.wait)

        try:
            neutron_rpc = service.serve_rpc()
        except NotImplementedError:
            LOG.info(_LI("RPC was already started in parent process by "
                         "plugin."))
        else:
            rpc_thread = pool.spawn(neutron_rpc.wait)

            # api and rpc should die together.  When one dies, kill the other.
            rpc_thread.link(lambda gt: api_thread.kill())
            api_thread.link(lambda gt: rpc_thread.kill())

        pool.waitall()
    except KeyboardInterrupt:
        pass
    except RuntimeError as e:
        sys.exit(_("ERROR: %s") % e)
示例#17
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 set_up_mocks(self):
        # Mock the configuration file

        args = ['--config-file', base.etcdir('neutron.conf')]
        neutron_config.init(args=args)

        # Configure the ML2 mechanism drivers and network types
        ml2_opts = {
            'mechanism_drivers': ['cisco_ucsm'],
            'tenant_network_types': ['vlan'],
        }
        for opt, val in ml2_opts.items():
            ml2_config.cfg.CONF.set_override(opt, val, 'ml2')

        # Configure the Cisco UCS Manager mechanism driver
        ucsm_test_config = {
            'ml2_cisco_ucsm_ip: 1.1.1.1': {
                'ucsm_username': UCSM_USERNAME_1,
                'ucsm_password': UCSM_PASSWORD_1,
            },
            'ml2_cisco_ucsm_ip: 2.2.2.2': {
                'ucsm_username': UCSM_USERNAME_2,
                'ucsm_password': UCSM_PASSWORD_2,
            },
        }
        self.mocked_parser = mock.patch.object(cfg,
            'MultiConfigParser').start()
        self.mocked_parser.return_value.read.return_value = [ucsm_test_config]
        self.mocked_parser.return_value.parsed = [ucsm_test_config]
    def set_up_mocks(self):
        # Mock the configuration file

        args = ["--config-file", base.etcdir("neutron.conf")]
        neutron_config.init(args=args)

        # Configure the ML2 mechanism drivers and network types
        ml2_opts = {"mechanism_drivers": ["cisco_ucsm"], "tenant_network_types": ["vlan"]}
        for opt, val in ml2_opts.items():
            ml2_config.cfg.CONF.set_override(opt, val, "ml2")

        # Configure the Cisco UCS Manager mechanism driver
        ucsm_test_config = {
            "ml2_cisco_ucsm_ip: 1.1.1.1": {
                "ucsm_username": [UCSM_USERNAME_1],
                "ucsm_password": [UCSM_PASSWORD_1],
                "ucsm_virtio_eth_ports": UCSM_VIRTIO_ETH_PORTS_1,
                "vnic_template_list": ["test-physnet:org-root:Test-VNIC"],
                "sriov_qos_policy": ["Test"],
            },
            "ml2_cisco_ucsm_ip: 2.2.2.2": {
                "ucsm_username": [UCSM_USERNAME_2],
                "ucsm_password": [UCSM_PASSWORD_2],
                "ucsm_virtio_eth_ports": UCSM_VIRTIO_ETH_PORTS_2,
                "vnic_template_list": ["physnet2:org-root/org-Test-Sub:Test"],
            },
            "sriov_multivlan_trunk": {"test_network1": ["5, 7 - 9"], "test_network2": ["500 - 509, 700"]},
        }
        expected_ucsm_dict = {
            "1.1.1.1": (UCSM_USERNAME_1, UCSM_PASSWORD_1),
            "2.2.2.2": (UCSM_USERNAME_2, UCSM_PASSWORD_2),
        }

        expected_ucsm_port_dict = {
            "1.1.1.1": [const.ETH_PREFIX + "eth0", const.ETH_PREFIX + "eth1"],
            "2.2.2.2": [const.ETH_PREFIX + "eth2", const.ETH_PREFIX + "eth3"],
        }

        expected_vnic_template_dict = {
            ("1.1.1.1", "test-physnet"): ("org-root", "Test-VNIC"),
            ("2.2.2.2", "physnet2"): ("org-root/org-Test-Sub", "Test"),
        }

        expected_sriov_qos_policy = {"1.1.1.1": "Test"}

        expected_multivlan_trunk_dict = {
            "test_network1": [5, 7, 8, 9],
            "test_network2": [500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 700],
        }

        self.mocked_parser = mock.patch.object(cfg, "MultiConfigParser").start()
        self.mocked_parser.return_value.read.return_value = [ucsm_test_config]
        self.mocked_parser.return_value.parsed = [ucsm_test_config]
        ucsm_config.UcsmConfig()
        self.assertEqual(expected_ucsm_dict, ucsm_config.UcsmConfig.ucsm_dict)
        self.assertEqual(expected_ucsm_port_dict, ucsm_config.UcsmConfig.ucsm_port_dict)
        self.assertEqual(expected_vnic_template_dict, ucsm_config.UcsmConfig.vnic_template_dict)
        self.assertEqual(expected_sriov_qos_policy, ucsm_config.UcsmConfig.sriov_qos_policy)
        self.assertEqual(expected_multivlan_trunk_dict, ucsm_config.UcsmConfig.multivlan_trunk_dict)
示例#20
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()
示例#21
0
def main():
    # Read in the command line args
    n_config.init(sys.argv[1:])
    n_config.setup_logging()

    # Build then run the agent
    agent = SharedEthernetNeutronAgent()
    LOG.info(_LI("Shared Ethernet Agent initialized and running"))
    agent.rpc_loop()
示例#22
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()
示例#23
0
def main(manager='neutron.services.tunnel.agent.TunnelAgentWithStateReport'):
    common_config.init(sys.argv[1:])
    config.setup_logging(cfg.CONF)
    server = neutron_service.Service.create(
            binary='neutron-tunnel-agent',
            topic=n_topics.TUNNEL_AGENT,
            report_interval=cfg.CONF.tunnel_agent.report_interval,
            manager=manager)
    service.launch(server).wait()
示例#24
0
文件: agent.py 项目: Anonymike/quark
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()
示例#25
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"])
示例#26
0
文件: base.py 项目: openstack/neutron
 def config_parse(conf=None, args=None):
     """Create the default configurations."""
     if args is None:
         args = []
     args += ['--config-file', etcdir('neutron.conf')]
     if conf is None:
         config.init(args=args)
     else:
         conf(args)
示例#27
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()
示例#28
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()
示例#29
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!"))
示例#30
0
 def config_parse(conf=None, args=None):
     """Create the default configurations."""
     # neutron.conf.test includes rpc_backend which needs to be cleaned up
     if args is None:
         args = ['--config-file', etcdir('neutron.conf.test')]
     if conf is None:
         config.init(args=args)
     else:
         conf(args)
示例#31
0
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()
示例#32
0
def launch(binary, manager, topic=None):
    cfg.CONF(project='neutron')
    common_cfg.init(sys.argv[1:])
    config.setup_logging()
    report_period = cfg.CONF.ml2_cisco_apic.apic_agent_report_interval
    poll_period = cfg.CONF.ml2_cisco_apic.apic_agent_poll_interval
    server = service.Service.create(
        binary=binary, manager=manager, topic=topic,
        report_interval=report_period, periodic_interval=poll_period)
    svc.launch(cfg.CONF, server).wait()
示例#33
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)
示例#34
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()
示例#35
0
def main():
    cfg.CONF.register_opts(WANTC_OPTS, 'WANTC')
    common_config.init(sys.argv[1:])
    config.setup_logging()
    server = neutron_service.Service.create(
        binary='tc_agent2',
        topic=topics.TC_AGENT,
        report_interval=10,
        manager='wan_qos.agent.tc_manager.TcAgentManager')
    service.launch(cfg.CONF, server).wait()
示例#36
0
def main(manager='neutron.agent.l3.agent.L3NATAgentWithStateReport'):
    register_opts(cfg.CONF)
    common_config.init(sys.argv[1:])
    config.setup_logging()
    server = neutron_service.Service.create(
        binary='neutron-l3-agent',
        topic=topics.L3_AGENT,
        report_interval=cfg.CONF.AGENT.report_interval,
        manager=manager)
    service.launch(cfg.CONF, server).wait()
示例#37
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!"))
示例#38
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)
    profiler.setup("neutron-ovs-agent", cfg.CONF.host)
    mod.main()
示例#39
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
示例#40
0
def main():
    register_options()
    common_config.init(sys.argv[1:])
    config.setup_logging()

    agent = aci_agent.AciNeutronAgent()

    # Start everything.
    LOG.info(_LI("ACI Agent initialized successfully, now running... "))
    agent.daemon_loop()
示例#41
0
 def config_parse(conf=None, args=None):
     """Create the default configurations."""
     # neutron.conf includes rpc_backend which needs to be cleaned up
     if args is None:
         args = []
     args += ['--config-file', etcdir('neutron.conf')]
     if conf is None:
         config.init(args=args)
     else:
         conf(args)
示例#42
0
def main():
    register_options(cfg.CONF)
    common_config.init(sys.argv[1:])
    config.setup_logging()
    server = neutron_service.Service.create(
        binary='neutron-dhcp-agent',
        topic=topics.DHCP_AGENT,
        report_interval=cfg.CONF.AGENT.report_interval,
        manager='neutron.agent.dhcp.agent.DhcpAgentWithStateReport')
    service.launch(cfg.CONF, server).wait()
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()
示例#44
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(
        ['networking_ofagent.plugins.ofagent.agent.ofa_neutron_agent'])
示例#45
0
    def set_up_mocks(self):
        # Mock the configuration file

        args = ['--config-file', base.etcdir('neutron.conf')]
        neutron_config.init(args=args)

        # Configure the ML2 mechanism drivers and network types
        ml2_opts = {
            'mechanism_drivers': ['cisco_ucsm'],
            'tenant_network_types': ['vlan'],
        }
        for opt, val in ml2_opts.items():
            ml2_config.cfg.CONF.set_override(opt, val, 'ml2')

        # Configure the Cisco UCS Manager mechanism driver
        ucsm_test_config = {
            'ml2_cisco_ucsm_ip: 1.1.1.1': {
                'ucsm_username': [UCSM_USERNAME_1],
                'ucsm_password': [UCSM_PASSWORD_1],
                'ucsm_virtio_eth_ports': UCSM_VIRTIO_ETH_PORTS_1,
                'vnic_template_list': ['test-physnet:org-root:Test-VNIC'],
            },
            'ml2_cisco_ucsm_ip: 2.2.2.2': {
                'ucsm_username': [UCSM_USERNAME_2],
                'ucsm_password': [UCSM_PASSWORD_2],
                'ucsm_virtio_eth_ports': UCSM_VIRTIO_ETH_PORTS_2,
                'vnic_template_list': ['physnet2:org-root/org-Test-Sub:Test']
            },
        }
        expected_ucsm_dict = {
            '1.1.1.1': [UCSM_PASSWORD_1, UCSM_USERNAME_1],
            '2.2.2.2': [UCSM_PASSWORD_2, UCSM_USERNAME_2],
        }

        expected_ucsm_port_dict = {
            '1.1.1.1': [const.ETH_PREFIX + 'eth0', const.ETH_PREFIX + 'eth1'],
            '2.2.2.2': [const.ETH_PREFIX + 'eth2', const.ETH_PREFIX + 'eth3'],
        }

        expected_vnic_template_dict = {
            ('1.1.1.1', 'test-physnet'): ('org-root', 'Test-VNIC'),
            ('2.2.2.2', 'physnet2'): ('org-root/org-Test-Sub', 'Test'),
        }

        self.mocked_parser = mock.patch.object(cfg,
            'MultiConfigParser').start()
        self.mocked_parser.return_value.read.return_value = [ucsm_test_config]
        self.mocked_parser.return_value.parsed = [ucsm_test_config]
        ucsm_config.UcsmConfig()
        self.assertEqual(expected_ucsm_dict,
                         ucsm_config.UcsmConfig.ucsm_dict)
        self.assertEqual(expected_ucsm_port_dict,
                         ucsm_config.UcsmConfig.ucsm_port_dict)
        self.assertEqual(expected_vnic_template_dict,
                         ucsm_config.UcsmConfig.vnic_template_dict)
示例#46
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()
示例#47
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!"))
示例#48
0
    def setUp(self):
        cfg.CONF.register_cli_opts(resources.cli_opts)

        super(AbstractTestAdminUtils, self).setUp()

        # Init the neutron config
        neutron_config.init(args=[
            '--config-file', BASE_CONF_PATH, '--config-file', NSX_INI_PATH
        ])
        self._init_mock_plugin()
        self._init_resource_plugin()
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()
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()
示例#51
0
def main():
    """The entry point for the Hyper-V Neutron Agent."""
    neutron_config.register_agent_state_opts_helper(CONF)
    common_config.init(sys.argv[1:])
    neutron_config.setup_logging()

    hyperv_agent = HyperVNeutronAgent()

    # Start everything.
    LOG.info("Agent initialized successfully, now running... ")
    hyperv_agent.daemon_loop()
示例#52
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)
示例#53
0
def main():
    register_options()
    common_config.init(sys.argv[1:])
    config.setup_logging()
    server = neutron_service.Service.create(
        binary='neutron-bgp-dragent',
        topic=bgp_consts.BGP_DRAGENT,
        report_interval=cfg.CONF.AGENT.report_interval,
        manager='neutron_dynamic_routing.services.bgp.agent.bgp_dragent.'
        'BgpDrAgentWithStateReport')
    service.launch(cfg.CONF, server).wait()
示例#54
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()
示例#55
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()
示例#56
0
def main(manager='neutron.agent.l3.agent.L3NATAgentWithStateReport'):
    register_opts(cfg.CONF)
    common_config.init(sys.argv[1:])
    config.setup_logging()
    config.setup_privsep()
    server = neutron_service.Service.create(
        binary=constants.AGENT_PROCESS_L3,
        topic=topics.L3_AGENT,
        report_interval=cfg.CONF.AGENT.report_interval,
        manager=manager)
    service.launch(cfg.CONF, server, restart_method='mutate').wait()
示例#57
0
def main():
    config.register_ovsdb_opts_helper(cfg.CONF)
    agent_config.register_agent_state_opts_helper(cfg.CONF)
    common_config.init(sys.argv[1:])
    config.setup_logging()

    mgr = manager.OVSDBManager(cfg.CONF)
    svc = L2gatewayAgentService(host=cfg.CONF.host,
                                topic=topics.L2GATEWAY_AGENT,
                                manager=mgr)
    service.launch(cfg.CONF, svc).wait()
示例#58
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))
示例#59
0
def main(manager='dragonflow.neutron.agent.l3.l3_controller_agent.'
         'L3ControllerAgentWithStateReport'):
    l3_agent.register_opts(cfg.CONF)
    common_config.init(sys.argv[1:])
    config.setup_logging()
    cfg.CONF.set_override('router_delete_namespaces', True)
    server = neutron_service.Service.create(
        binary='neutron-l3-controller-agent',
        topic=topics.L3_AGENT,
        report_interval=cfg.CONF.AGENT.report_interval,
        manager=manager)
    service.launch(cfg.CONF, server).wait()
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)