Esempio n. 1
0
def main():
    register_f5_opts(cfg.CONF)
    agent_config.register_agent_state_opts_helper(cfg.CONF)
    common_config.init(sys.argv[1:])
    common_config.setup_logging()

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

    polling_interval = cfg.CONF.AGENT.polling_interval
    quitting_rpc_timeout = cfg.CONF.AGENT.quitting_rpc_timeout
    f5manager = F5Manager(device_mappings)
    agent = ca.CommonAgentLoop(f5manager, polling_interval,
                               quitting_rpc_timeout, constants.AGENT_TYPE_F5,
                               constants.AGENT_BINARY)

    LOG.info('networking-f5-agent initialized, starting up...')
    if cfg.CONF.F5.prometheus:
        start_http_server(8000)
    service.launch(cfg.CONF, agent, restart_method='mutate').wait()
 def setUp(self):
     super(TestBaseAgentManager, self).setUp()
     agent_config.register_agent_state_opts_helper(cfg.CONF)
     cfg.CONF.set_override('report_interval', 1, 'AGENT')
     self.context = mock.Mock
     mock.patch('neutron.agent.rpc.PluginReportStateAPI').start()
     self.l2gw_agent_manager = l2gw_manager.BaseAgentManager(cfg.CONF)
Esempio n. 3
0
def register_options(conf):
    config.register_interface_driver_opts_helper(conf)
    config.register_agent_state_opts_helper(conf)
    config.register_availability_zone_opts_helper(conf)
    dhcp_config.register_agent_dhcp_opts(conf)
    meta_conf.register_meta_conf_opts(meta_conf.SHARED_OPTS, conf)
    conf.register_opts(interface.OPTS)
Esempio n. 4
0
 def setUp(self):
     super(TestManager, self).setUp()
     self.conf = cfg.CONF
     config.register_ovsdb_opts_helper(self.conf)
     agent_config.register_agent_state_opts_helper(self.conf)
     self.driver_mock = mock.Mock()
     self.fake_record_dict = {n_const.OVSDB_IDENTIFIER: 'fake_ovsdb_id'}
     cfg.CONF.set_override('report_interval', 1, 'AGENT')
     self.plugin_rpc = mock.patch.object(agent_api,
                                         'L2GatewayAgentApi').start()
     self.context = mock.Mock
     self.cntxt = mock.patch.object(
         context, 'get_admin_context_without_session').start()
     self.test_rpc = mock.patch.object(rpc, 'get_client').start()
     self.mock_looping_call = mock.patch.object(
         loopingcall, 'FixedIntervalLoopingCall').start()
     self.l2gw_agent_manager = manager.OVSDBManager(self.conf)
     self.l2gw_agent_manager.plugin_rpc = self.plugin_rpc
     self.fake_config_json = {
         n_const.OVSDB_IDENTIFIER: 'fake_ovsdb_identifier',
         'ovsdb_ip': '5.5.5.5',
         'ovsdb_port': '6672',
         'private_key': 'dummy_key',
         'enable_ssl': False,
         'certificate': 'dummy_cert',
         'ca_cert': 'dummy_ca'
     }
Esempio n. 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()
Esempio n. 6
0
 def setUp(self):
     super(TestManager, self).setUp()
     self.conf = cfg.CONF
     config.register_ovsdb_opts_helper(self.conf)
     agent_config.register_agent_state_opts_helper(self.conf)
     self.driver_mock = mock.Mock()
     self.fake_record_dict = {n_const.OVSDB_IDENTIFIER: 'fake_ovsdb_id'}
     cfg.CONF.set_override('report_interval', 1, 'AGENT')
     self.plugin_rpc = mock.patch.object(agent_api,
                                         'L2GatewayAgentApi').start()
     self.context = mock.Mock
     self.cntxt = mock.patch.object(context,
                                    'get_admin_context_without_session'
                                    ).start()
     self.test_rpc = mock.patch.object(rpc, 'get_client').start()
     self.mock_looping_call = mock.patch.object(loopingcall,
                                                'FixedIntervalLoopingCall'
                                                ).start()
     self.l2gw_agent_manager = manager.OVSDBManager(
         self.conf)
     self.l2gw_agent_manager.plugin_rpc = self.plugin_rpc
     self.fake_config_json = {n_const.OVSDB_IDENTIFIER:
                              'fake_ovsdb_identifier',
                              'ovsdb_ip': '5.5.5.5',
                              'ovsdb_port': '6672',
                              'private_key': 'dummy_key',
                              'enable_ssl': False,
                              'certificate': 'dummy_cert',
                              'ca_cert': 'dummy_ca'}
Esempio n. 7
0
def register_options(conf):
    config.register_interface_driver_opts_helper(conf)
    config.register_agent_state_opts_helper(conf)
    config.register_availability_zone_opts_helper(conf)
    dhcp_config.register_agent_dhcp_opts(conf)
    meta_conf.register_meta_conf_opts(meta_conf.SHARED_OPTS, conf)
    conf.register_opts(interface.OPTS)
Esempio n. 8
0
 def _get_config_opts(self):
     config = cfg.ConfigOpts()
     config.register_opts(common_config.core_opts)
     ovs_conf.register_ovs_agent_opts(config)
     agent_config.register_interface_opts(config)
     agent_config.register_interface_driver_opts_helper(config)
     agent_config.register_agent_state_opts_helper(config)
     ext_manager.register_opts(config)
     return config
Esempio n. 9
0
 def _get_config_opts(self):
     config = cfg.ConfigOpts()
     config.register_opts(common_config.core_opts)
     ovs_conf.register_ovs_agent_opts(config)
     agent_config.register_interface_opts(config)
     agent_config.register_interface_driver_opts_helper(config)
     agent_config.register_agent_state_opts_helper(config)
     ext_manager.register_opts(config)
     return config
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()
Esempio n. 11
0
def register_opts(conf):
    l3_config.register_l3_agent_config_opts(l3_config.OPTS, conf)
    ha_conf.register_l3_agent_ha_opts(conf)
    meta_conf.register_meta_conf_opts(meta_conf.SHARED_OPTS, conf)
    config.register_interface_driver_opts_helper(conf)
    config.register_agent_state_opts_helper(conf)
    config.register_interface_opts(conf)
    config.register_external_process_opts(conf)
    config.register_pddriver_opts(conf)
    config.register_ra_opts(conf)
    config.register_availability_zone_opts_helper(conf)
Esempio n. 12
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()
Esempio n. 13
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()
Esempio n. 14
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, restart_method='mutate').wait()
Esempio n. 15
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()
Esempio n. 16
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()
Esempio n. 17
0
def main():
    conf = cfg.CONF
    common_config.register_common_config_options()
    metering_agent.register_metering_agent_opts()
    config.register_agent_state_opts_helper(conf)
    common_config.init(sys.argv[1:])
    config.setup_logging()
    config.setup_privsep()
    server = neutron_service.Service.create(
        binary=constants.AGENT_PROCESS_METERING,
        topic=topics.METERING_AGENT,
        report_interval=cfg.CONF.AGENT.report_interval,
        manager='neutron.services.metering.agents.'
        'metering_agent.MeteringAgentWithStateReport')
    service.launch(cfg.CONF, server, restart_method='mutate').wait()
Esempio n. 18
0
    def setUp(self):
        super(TestLayer2Agent, self).setUp()
        neutron_config.register_agent_state_opts_helper(CONF)

        self._agent = self._get_agent()

        self._agent._utils = mock.MagicMock(autospec=self._agent._utils)
        self._agent._plugin_rpc = mock.Mock(
            autospec=agent_base.agent_rpc.PluginApi)
        self._agent._endpoints = mock.MagicMock()
        self._agent._client = mock.MagicMock(
            autospec=agent_base.n_rpc.BackingOffClient)
        self._agent._connection = mock.MagicMock(
            autospec=agent_base.n_rpc.Connection)
        self._agent._physical_network_mappings = collections.OrderedDict()
        self._agent._network_vswitch_map = {}
Esempio n. 19
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()
Esempio n. 20
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()
Esempio n. 21
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()
Esempio n. 22
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()
 def test_bgp_dragent_manager(self):
     state_rpc_str = 'neutron.agent.rpc.PluginReportStateAPI'
     # sync_state is needed for this test
     with mock.patch.object(bgp_dragent.BgpDrAgentWithStateReport,
                            'sync_state',
                            autospec=True) as mock_sync_state:
         with mock.patch(state_rpc_str) as state_rpc:
             with mock.patch.object(sys, 'argv') as sys_argv:
                 sys_argv.return_value = [
                     'bgp_dragent', '--config-file',
                     base.etcdir('neutron.conf')]
                 config.register_agent_state_opts_helper(cfg.CONF)
                 n_config.init(sys.argv[1:])
                 agent_mgr = bgp_dragent.BgpDrAgentWithStateReport(
                     'testhost')
                 eventlet.greenthread.sleep(1)
                 agent_mgr.after_start()
                 self.assertIsNotNone(len(mock_sync_state.mock_calls))
                 state_rpc.assert_has_calls(
                     [mock.call(mock.ANY),
                      mock.call().report_state(mock.ANY, mock.ANY,
                                               mock.ANY)])
Esempio n. 24
0
    def setUp(self):
        super(TestLayer2Agent, self).setUp()
        neutron_config.register_agent_state_opts_helper(CONF)

        self._agent = self._get_agent()

        self._agent._qos_ext = mock.MagicMock()
        self._agent._plugin_rpc = mock.Mock()
        self._agent._metricsutils = mock.MagicMock()
        self._agent._utils = mock.MagicMock()
        self._agent._context = mock.Mock()
        self._agent._client = mock.MagicMock()
        self._agent._connection = mock.MagicMock()
        self._agent._agent_id = mock.Mock()
        self._agent._utils = mock.MagicMock()
        self._agent._nvgre_ops = mock.MagicMock()
        self._agent._vlan_driver = mock.MagicMock()
        self._agent._physical_network_mappings = collections.OrderedDict()
        self._agent._config = mock.MagicMock()
        self._agent._endpoints = mock.MagicMock()
        self._agent._event_callback_pairs = mock.MagicMock()
        self._agent._network_vswitch_map = {}
Esempio n. 25
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()
 def test_bgp_dragent_manager(self, mock_init):
     mock_init.return_value = '/tmp/test'
     state_rpc_str = 'neutron.agent.rpc.PluginReportStateAPI'
     # sync_state is needed for this test
     with mock.patch.object(bgp_dragent.BgpDrAgentWithStateReport,
                            'sync_state',
                            autospec=True) as mock_sync_state:
         with mock.patch(state_rpc_str) as state_rpc:
             test_args = [
                 'bgp_dragent', '--config-file',
                 base.etcdir('neutron.conf')
             ]
             with mock.patch.object(sys, 'argv', test_args):
                 config.register_agent_state_opts_helper(cfg.CONF)
                 n_config.init(sys.argv[1:])
                 agent_mgr = bgp_dragent.BgpDrAgentWithStateReport(
                     'testhost')
                 eventlet.greenthread.sleep(1)
                 agent_mgr.after_start()
                 self.assertIsNotNone(len(mock_sync_state.mock_calls))
                 state_rpc.assert_has_calls(
                     [mock.call(mock.ANY),
                      mock.call().report_state(mock.ANY, mock.ANY,
                                               mock.ANY)])
Esempio n. 27
0
def register_options():
    agent_conf.register_agent_state_opts_helper(cfg.CONF)
    config.register_infoblox_ipam_opts(cfg.CONF)
    config.register_infoblox_grid_opts(cfg.CONF,
                                       cfg.CONF.infoblox.cloud_data_center_id)
Esempio n. 28
0
               help=_("OVS Peer patch port in tunnel bridge to MPLS bridge ")),
    cfg.StrOpt('mpls_to_tun_peer_patch_port',
               default='patch-from-tun',
               help=_("OVS Peer patch port in MPLS bridge to tunnel bridge ")),
    cfg.StrOpt('mpls_to_int_peer_patch_port',
               default='patch-mpls-to-int',
               help=_("OVS Peer patch port in MPLS bridge to int bridge ")),
    cfg.StrOpt('int_to_mpls_peer_patch_port',
               default='patch-int-from-mpls',
               help=_("OVS Peer patch port in int bridge to MPLS bridge ")),
]

cfg.CONF.register_opts(bagpipe_bgpvpn_opts, "BAGPIPE")
cfg.CONF.register_opts(internal_opts, "BAGPIPE")
ovs_conf.register_ovs_agent_opts()
config.register_agent_state_opts_helper(cfg.CONF)


def format_associations_route_targets(assocs):
    rts = collections.defaultdict(set)
    for assoc in assocs:
        rts[bbgp_const.RT_IMPORT] |= set(assoc.bgpvpn.route_targets or ())
        rts[bbgp_const.RT_IMPORT] |= set(assoc.bgpvpn.import_targets or ())

        rts[bbgp_const.RT_EXPORT] |= set(assoc.bgpvpn.route_targets or ())
        rts[bbgp_const.RT_EXPORT] |= set(assoc.bgpvpn.export_targets or ())

    return rts


def bagpipe_vpn_type(bgpvpn_type):
Esempio n. 29
0
def register_options():
    config.register_agent_state_opts_helper(cfg.CONF)
    config.register_root_helper(cfg.CONF)
    cfg.CONF.register_opts(bgp_dragent_config.BGP_DRIVER_OPTS, 'BGP')
    cfg.CONF.register_opts(bgp_dragent_config.BGP_PROTO_CONFIG_OPTS, 'BGP')
    config.register_external_process_opts(cfg.CONF)
Esempio n. 30
0
def load_config():
    db_options.set_defaults(cfg.CONF)
    # cfg.CONF.register_opts(manager.OPTS)
    config.register_agent_state_opts_helper(cfg.CONF)
    config.register_root_helper(cfg.CONF)
    common_config.init(sys.argv[1:])
def register_config_opts():
    neutron_config.register_agent_state_opts_helper(CONF)
    meta_config.register_meta_conf_opts(
        meta_config.METADATA_PROXY_HANDLER_OPTS)
Esempio n. 32
0
# Copyright 2012 Red Hat, Inc.
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

from oslo_config import cfg

from neutron.conf.agent import common as config
from neutron.conf.plugins.ml2.drivers import agent
from neutron.conf.plugins.ml2.drivers import ovs_conf

agent.register_agent_opts()
ovs_conf.register_ovs_agent_opts()
config.register_agent_state_opts_helper(cfg.CONF)