本文整理汇总了Python中neutron.common.config.init函数的典型用法代码示例。如果您正苦于以下问题:Python init函数的具体用法?Python init怎么用?Python init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了init函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: main
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)
开发者ID:bradleyjones,项目名称:neutron,代码行数:25,代码来源:eswitch_neutron_agent.py
示例2: set_up_mocks
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]
开发者ID:CiscoKorea,项目名称:networking-cisco,代码行数:29,代码来源:test_cisco_ucsm_common.py
示例3: main
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
开发者ID:openstack,项目名称:group-based-policy,代码行数:26,代码来源:cli.py
示例4: main
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()
开发者ID:AKamyshnikova,项目名称:python-opflex-agent,代码行数:30,代码来源:gbp_ovs_agent.py
示例5: main
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)
开发者ID:HybridCloud-dew,项目名称:hws,代码行数:31,代码来源:servicechain_agent.py
示例6: main
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()
开发者ID:noironetworks,项目名称:neutron,代码行数:35,代码来源:linuxbridge_neutron_agent.py
示例7: main
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()
开发者ID:xujinrong,项目名称:dragonflow,代码行数:30,代码来源:ovs_dragonflow_neutron_agent.py
示例8: main
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()
开发者ID:CNlukai,项目名称:networking-sfc,代码行数:25,代码来源:agent.py
示例9: main
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()
开发者ID:nikesh-mahalka,项目名称:networking-bgpvpn,代码行数:27,代码来源:ovs_bagpipe_neutron_agent.py
示例10: main
def main():
register_options(cfg.CONF)
calico_config.register_options(cfg.CONF)
common_config.init(sys.argv[1:])
setup_logging()
agent = CalicoDhcpAgent()
agent.run()
开发者ID:openstack,项目名称:networking-calico,代码行数:7,代码来源:dhcp_agent.py
示例11: main
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()
开发者ID:noironetworks,项目名称:neutron,代码行数:33,代码来源:sriov_nic_agent.py
示例12: main
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()
开发者ID:openstack,项目名称:networking-infoblox,代码行数:7,代码来源:infoblox_ipam_agent.py
示例13: main
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()
开发者ID:dims,项目名称:neutron,代码行数:32,代码来源:linuxbridge_neutron_agent.py
示例14: main
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()
开发者ID:MODITDC,项目名称:neutron,代码行数:28,代码来源:sriov_nic_agent.py
示例15: main
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)
开发者ID:Akanksha08,项目名称:neutron,代码行数:30,代码来源:__init__.py
示例16: setUp
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
开发者ID:Anonymike,项目名称:quark,代码行数:28,代码来源:test_base.py
示例17: main
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)
开发者ID:fortara,项目名称:neutron,代码行数:27,代码来源:ryu_neutron_agent.py
示例18: main
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()
开发者ID:FrankDuan,项目名称:df_code,代码行数:7,代码来源:df_publisher_service.py
示例19: set_up_mocks
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)
开发者ID:noironetworks,项目名称:networking-cisco,代码行数:59,代码来源:test_cisco_ucsm_common.py
示例20: main
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()
开发者ID:sajeevm,项目名称:networking-nec,代码行数:8,代码来源:nwa_agent.py
注:本文中的neutron.common.config.init函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论