def _configure_agent(self, host):
        """Override specific config options"""
        config = self._get_config_opts()
        l3_agent_main.register_opts(config)
        cfg.CONF.set_override('debug', True)
        agent_config.setup_logging()
        config.set_override('extensions', ['vpnaas'], 'agent')
        config.set_override(
            'interface_driver',
            'neutron.agent.linux.interface.OVSInterfaceDriver')

        br_int = self.useFixture(net_helpers.OVSBridgeFixture()).bridge
        config.set_override('ovs_integration_bridge', br_int.br_name)

        temp_dir = self.get_new_temp_dir()
        get_temp_file_path = functools.partial(self.get_temp_file_path,
                                               root=temp_dir)
        config.set_override('state_path', temp_dir.path)
        config.set_override('metadata_proxy_socket',
                          get_temp_file_path('metadata_proxy'))
        config.set_override('ha_confs_path',
                          get_temp_file_path('ha_confs'))
        config.set_override('external_pids',
                          get_temp_file_path('external/pids'))
        config.set_override('host', host)
        ipsec_config_base_dir = '%s/%s' % (temp_dir.path, 'ipsec')
        config.set_override('config_base_dir',
                          ipsec_config_base_dir, group='ipsec')

        # Assign ip address to br-int port because it is a gateway
        ex_port = ip_lib.IPDevice(br_int.br_name)
        ex_port.addr.add(str(PUBLIC_NET[1]))

        return config
    def _configure_agent(self, host):
        """Override specific config options"""
        config = self._get_config_opts()
        l3_agent_main.register_opts(config)
        cfg.CONF.set_override('debug', True)
        agent_config.setup_logging()
        config.set_override('extensions', ['vpnaas'], 'agent')
        config.set_override(
            'interface_driver',
            'neutron.agent.linux.interface.OVSInterfaceDriver')

        br_int = self.useFixture(net_helpers.OVSBridgeFixture()).bridge
        config.set_override('ovs_integration_bridge', br_int.br_name)

        temp_dir = self.get_new_temp_dir()
        get_temp_file_path = functools.partial(self.get_temp_file_path,
                                               root=temp_dir)
        config.set_override('state_path', temp_dir.path)
        config.set_override('metadata_proxy_socket',
                            get_temp_file_path('metadata_proxy'))
        config.set_override('ha_confs_path', get_temp_file_path('ha_confs'))
        config.set_override('external_pids',
                            get_temp_file_path('external/pids'))
        config.set_override('host', host)
        ipsec_config_base_dir = '%s/%s' % (temp_dir.path, 'ipsec')
        config.set_override('config_base_dir',
                            ipsec_config_base_dir,
                            group='ipsec')

        # Assign ip address to br-int port because it is a gateway
        ex_port = ip_lib.IPDevice(br_int.br_name)
        ex_port.addr.add(str(PUBLIC_NET[1]))

        return config
def main():
    """The entry point for neutron-hnv-metadata-proxy."""
    register_config_opts()
    common_config.init(sys.argv[1:])
    neutron_config.setup_logging()
    proxy = MetadataProxy()
    proxy.run()
Example #4
0
    def setUp(self):
        super(DHCPAgentOVSTestFramework, self).setUp()
        config.setup_logging()
        self.conf_fixture = self.useFixture(fixture_config.Config())
        self.conf = self.conf_fixture.conf
        dhcp_agent.register_options(self.conf)

        # NOTE(cbrandily): TempDir fixture creates a folder with 0o700
        # permissions but agent dir must be readable by dnsmasq user (nobody)
        agent_config_dir = self.useFixture(fixtures.TempDir()).path
        self.useFixture(
            helpers.RecursivePermDirFixture(agent_config_dir, 0o555))

        self.conf.set_override("dhcp_confs", agent_config_dir)
        self.conf.set_override(
            'interface_driver',
            'neutron.agent.linux.interface.OVSInterfaceDriver')
        self.conf.set_override('report_interval', 0, 'AGENT')
        br_int = self.useFixture(net_helpers.OVSBridgeFixture()).bridge
        self.conf.set_override('ovs_integration_bridge', br_int.br_name)

        self.mock_plugin_api = mock.patch(
            'neutron.agent.dhcp.agent.DhcpPluginApi').start().return_value
        mock.patch('neutron.agent.rpc.PluginReportStateAPI').start()
        self.agent = agent.DhcpAgentWithStateReport('localhost')

        self.ovs_driver = interface.OVSInterfaceDriver(self.conf)

        self.conf.set_override('check_child_processes_interval', 1, 'AGENT')
Example #5
0
def main():
    """F5 BIG-IQ agent for OpenStack."""
    cfg.CONF.register_opts(OPTS)
    cfg.CONF.register_opts(manager.OPTS)
    cfg.CONF.register_opts(INTERFACE_OPTS)

    config.register_agent_state_opts_helper(cfg.CONF)
    config.register_root_helper(cfg.CONF)

    common_config.init(sys.argv[1:])
    config.setup_logging()

    if not cfg.CONF.agent_id:
        LOG.error("Agent ID is undefined. Quit process.")
        sys.exit(1)

    if not cfg.CONF.bigiq_host:
        LOG.error("BIG-IQ host is undefined. Quit process.")
        sys.exit(1)

    mgr = manager.F5BIGIQAgentManager(cfg.CONF)

    svc = F5BIGIQAgentService(host=mgr.agent_host,
                              topic=constants.TOPIC_LBAASV2_BIGIQ_AGENT,
                              manager=mgr)

    service_launch = service_launcher.F5ServiceLauncher(cfg.CONF)
    service_launch.launch_service(svc)
    service_launch.wait()
Example #6
0
    def setUp(self):
        super(DHCPAgentOVSTestFramework, self).setUp()
        config.setup_logging()
        self.conf_fixture = self.useFixture(fixture_config.Config())
        self.conf = self.conf_fixture.conf
        dhcp_agent.register_options(self.conf)

        # NOTE(cbrandily): TempDir fixture creates a folder with 0o700
        # permissions but agent dir must be readable by dnsmasq user (nobody)
        agent_config_dir = self.useFixture(fixtures.TempDir()).path
        self.useFixture(
            helpers.RecursivePermDirFixture(agent_config_dir, 0o555))

        self.conf.set_override("dhcp_confs", agent_config_dir)
        self.conf.set_override(
            'interface_driver',
            'neutron.agent.linux.interface.OVSInterfaceDriver')
        self.conf.set_override('report_interval', 0, 'AGENT')
        br_int = self.useFixture(net_helpers.OVSBridgeFixture()).bridge
        self.conf.set_override('integration_bridge', br_int.br_name, 'OVS')

        self.mock_plugin_api = mock.patch(
            'neutron.agent.dhcp.agent.DhcpPluginApi').start().return_value
        mock.patch('neutron.agent.rpc.PluginReportStateAPI').start()
        self.agent = agent.DhcpAgentWithStateReport('localhost')

        self.ovs_driver = interface.OVSInterfaceDriver(self.conf)

        self.conf.set_override('check_child_processes_interval', 1, 'AGENT')
 def setUp(self):
     super(TestNetnsWrapper, self).setUp()
     config.setup_logging()
     self.fake_ns = 'func-8f1b728c-6eca-4042-9b6b-6ef66ab9352a'
     self.mount_paths = ('--mount_paths=/etc:/var/lib/neutron'
                         '/vpnaas/%(ns)s/etc,/var/run:/var/lib'
                         '/neutron/vpnaas/%(ns)s/var/run')
     self.fake_pth = self.mount_paths % {'ns': self.fake_ns}
Example #8
0
 def setUp(self):
     super(TestNetnsWrapper, self).setUp()
     config.setup_logging()
     self.fake_ns = 'func-8f1b728c-6eca-4042-9b6b-6ef66ab9352a'
     self.mount_paths = ('--mount_paths=/etc:/var/lib/neutron'
                         '/vpnaas/%(ns)s/etc,/var/run:/var/lib'
                         '/neutron/vpnaas/%(ns)s/var/run')
     self.fake_pth = self.mount_paths % {'ns': self.fake_ns}
Example #9
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.DhcpAgentWithDelayedStart')
    service.launch(cfg.CONF, server).wait()
Example #10
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()
Example #11
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()
Example #12
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, restart_method='mutate').wait()
Example #13
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()
Example #14
0
def main():
    register_options(cfg.CONF)
    common_config.init(sys.argv[1:])
    config.setup_logging()
    config.setup_privsep()
    server = neutron_service.Service.create(
        binary=constants.AGENT_PROCESS_DHCP,
        topic=topics.DHCP_AGENT,
        report_interval=cfg.CONF.AGENT.report_interval,
        manager='neutron.agent.dhcp.agent.DhcpAgentWithStateReport')
    service.launch(cfg.CONF, server, restart_method='mutate').wait()
Example #15
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='neutron-l3-agent',
        topic=topics.L3_AGENT,
        report_interval=cfg.CONF.AGENT.report_interval,
        manager=manager)
    service.launch(cfg.CONF, server).wait()
def launch(binary, manager, topic=None):
    cfg.CONF(project='neutron')
    common_cfg.init(sys.argv[1:])
    config.setup_logging()
    report_period = cfg.CONF.apic_host_agent.apic_agent_report_interval
    poll_period = cfg.CONF.apic_host_agent.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()
def main():
    conf = cfg.CONF
    metering_agent.register_metering_agent_opts()
    config.register_agent_state_opts_helper(conf)
    common_config.init(sys.argv[1:])
    config.setup_logging()
    server = neutron_service.Service.create(
        binary='neutron-metering-agent',
        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()
Example #18
0
def main():
    conf = cfg.CONF
    metering_agent.register_metering_agent_opts()
    config.register_agent_state_opts_helper(conf)
    common_config.init(sys.argv[1:])
    config.setup_logging()
    server = neutron_service.Service.create(
        binary='neutron-metering-agent',
        topic=topics.METERING_AGENT,
        report_interval=cfg.CONF.AGENT.report_interval,
        manager='neutron.services.metering.agents.'
        'metering_agent.MeteringAgentWithStateReport')
    service.launch(cfg.CONF, server).wait()
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.
    """
    cfg.CONF(sys.argv[1:])
    config.setup_logging()
    config.setup_privsep()
    remove_empty_bridges()
Example #20
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()
Example #21
0
 def initialize_app(self, argv):
     super(NeutronDebugShell, self).initialize_app(argv)
     if not self.options.config_file:
         raise exc.CommandError(
             _("You must provide a config file for bridge -"
               " either --config-file or env[NEUTRON_TEST_CONFIG_FILE]"))
     client = self.client_manager.neutron
     config.register_interface_opts()
     config.register_interface_driver_opts_helper(cfg.CONF)
     cfg.CONF(['--config-file', self.options.config_file])
     config.setup_logging()
     driver = utils.load_interface_driver(cfg.CONF)
     self.debug_agent = debug_agent.NeutronDebugAgent(
         cfg.CONF, client, driver)
     self.log.warning('This tool is deprecated and will be removed '
                      'in the future to be replaced with a more '
                      'powerful troubleshooting toolkit.')
Example #22
0
 def initialize_app(self, argv):
     super(NeutronDebugShell, self).initialize_app(argv)
     if not self.options.config_file:
         raise exc.CommandError(
             _("You must provide a config file for bridge -"
               " either --config-file or env[NEUTRON_TEST_CONFIG_FILE]"))
     client = self.client_manager.neutron
     config.register_interface_opts()
     config.register_interface_driver_opts_helper(cfg.CONF)
     cfg.CONF(['--config-file', self.options.config_file])
     config.setup_logging()
     driver = utils.load_interface_driver(cfg.CONF)
     self.debug_agent = debug_agent.NeutronDebugAgent(cfg.CONF,
                                                      client,
                                                      driver)
     self.log.warning('This tool is deprecated and will be removed '
                      'in the future to be replaced with a more '
                      'powerful troubleshooting toolkit.')
Example #23
0
def main():
    cfg.CONF.register_opts(OPTS)
    cfg.CONF.register_opts(manager.OPTS)
    # import interface options just in case the driver uses namespaces
    cfg.CONF.register_opts(interface.OPTS)
    cfg.CONF.register_opts(external_process.OPTS)
    config.register_interface_driver_opts_helper(cfg.CONF)
    config.register_agent_state_opts_helper(cfg.CONF)
    config.register_root_helper(cfg.CONF)

    common_config.init(sys.argv[1:])
    config.setup_logging()

    mgr = manager.LbaasAgentManager(cfg.CONF)
    svc = LbaasAgentService(host=cfg.CONF.host,
                            topic=constants.LOADBALANCER_AGENTV2,
                            manager=mgr)
    service.launch(cfg.CONF, svc).wait()
Example #24
0
def main():
    """F5 LBaaS agent for OpenStack."""
    cfg.CONF.register_opts(OPTS)
    cfg.CONF.register_opts(manager.OPTS)
    # pzhang(NOTE): may not be used anywhere, needs to check
    cfg.CONF.register_opts(INTERFACE_OPTS)

    config.register_agent_state_opts_helper(cfg.CONF)
    config.register_root_helper(cfg.CONF)

    common_config.init(sys.argv[1:])
    # alias for common_config.setup_logging()...
    config.setup_logging()

    mgr = manager.LbaasAgentManager(cfg.CONF)

    svc = F5AgentService(host=mgr.agent_host,
                         topic=f5constants.TOPIC_LOADBALANCER_AGENT_V2,
                         manager=mgr)
    service.launch(cfg.CONF, svc).wait()
Example #25
0
def main():
    # Load the configuration parameters.
    cfg.CONF.register_opts(OPTS)
    config.register_root_helper(cfg.CONF)
    common_config.init(sys.argv[1:])
    config.setup_logging()

    # Set up RPC
    mgr = taas_ovs_agent.TaasOvsAgentRpcCallback(cfg.CONF)
    endpoints = [mgr]
    conn = n_rpc.create_connection()
    conn.create_consumer(topics.TAAS_AGENT, endpoints, fanout=False)
    conn.consume_in_threads()

    svc = TaaSOVSAgentService(
        host=cfg.CONF.host,
        topic=topics.TAAS_PLUGIN,
        manager=mgr
        )
    service.launch(cfg.CONF, svc).wait()
Example #26
0
def main():
    """F5 LBaaS agent for OpenStack."""
    cfg.CONF.register_opts(OPTS)
    cfg.CONF.register_opts(manager.OPTS)
    cfg.CONF.register_opts(interface.OPTS)

    config.register_agent_state_opts_helper(cfg.CONF)
    config.register_root_helper(cfg.CONF)

    common_config.init(sys.argv[1:])
    # alias for common_config.setup_logging()...
    config.setup_logging()

    mgr = manager.LbaasAgentManager(cfg.CONF)

    svc = F5AgentService(
        host=mgr.agent_host,
        topic=f5constants.TOPIC_LOADBALANCER_AGENT_V2,
        manager=mgr
    )
    service.launch(cfg.CONF, svc).wait()
Example #27
0
def main():
    cfg.CONF.register_opts(OPTS)
    cfg.CONF.register_opts(manager.OPTS)
    # import interface options just in case the driver uses namespaces
    config.register_interface_opts(cfg.CONF)
    config.register_external_process_opts(cfg.CONF)
    config.register_interface_driver_opts_helper(cfg.CONF)
    config.register_agent_state_opts_helper(cfg.CONF)
    config.register_root_helper(cfg.CONF)

    common_config.init(sys.argv[1:])
    config.setup_logging()
    config.setup_privsep()

    LOG.warning('neutron-lbaas is now deprecated. See: '
                'https://wiki.openstack.org/wiki/Neutron/LBaaS/Deprecation')

    mgr = manager.LbaasAgentManager(cfg.CONF)
    svc = LbaasAgentService(host=cfg.CONF.host,
                            topic=constants.LOADBALANCER_AGENTV2,
                            manager=mgr)
    service.launch(cfg.CONF, svc).wait()
Example #28
0
def setup_logging():
    config.setup_logging()

    # logging is set up as it is done for neutron agent, so
    # in order to log additionally to file we simply need to add
    # file handler to root logger
    root_logger = logging.getLogger()

    # FIXME(aroma-x) - move logging settings to configuration
    # file in future
    log_file = '/var/log/neutron/dhcp-agent.log'
    log_format = ('%(asctime)s [%(thread)d] (%(levelname)s) '
                  '%(module)s: %(message)s')
    log_level = logging.DEBUG

    # Ensure that log file directory exists.
    mkdir_p(os.path.dirname(log_file))

    fh = logging.FileHandler(log_file)
    fh.setLevel(log_level)
    fh.setFormatter(logging.Formatter(log_format))

    root_logger.addHandler(fh)
Example #29
0
def main():
    cfg.CONF.register_opts(OPTS)
    cfg.CONF.register_opts(manager.OPTS)
    # import interface options just in case the driver uses namespaces
    config.register_interface_opts(cfg.CONF)
    config.register_external_process_opts(cfg.CONF)
    config.register_interface_driver_opts_helper(cfg.CONF)
    config.register_agent_state_opts_helper(cfg.CONF)
    config.register_root_helper(cfg.CONF)

    common_config.init(sys.argv[1:])
    config.setup_logging()
    config.setup_privsep()

    LOG.warning('neutron-lbaas is now deprecated. See: '
                'https://wiki.openstack.org/wiki/Neutron/LBaaS/Deprecation')

    mgr = manager.LbaasAgentManager(cfg.CONF)
    svc = LbaasAgentService(
        host=cfg.CONF.host,
        topic=constants.LOADBALANCER_AGENTV2,
        manager=mgr
    )
    service.launch(cfg.CONF, svc).wait()
Example #30
0
from oslo_utils import importutils

# import pdb; pdb.set_trace()
# connection = mysql+pymysql://root:[email protected]/neutron?charset=utf8
db_options.set_defaults(cfg.CONF)

cfg.CONF.register_opts(manager.OPTS)
cfg.CONF.register_opts(INTERFACE_OPTS)
config.register_agent_state_opts_helper(cfg.CONF)
config.register_root_helper(cfg.CONF)

common_config.init(sys.argv[1:])
cfg.CONF(sys.argv[1:])

config.setup_logging()

context = ncontext.get_admin_context()
db = ldbv2.LoadBalancerPluginDbv2()
loadbalancer_id = "4c7b2839-798f-479f-8893-a9f2e51e723f"


def load_driver(conf):
    lbdriver = None
    try:
        lbdriver = importutils.import_object(conf.f5_bigip_lbaas_device_driver,
                                             conf)
        return lbdriver
    except ImportError as ie:
        raise SystemExit(msg)