本文整理汇总了Python中neutron.plugins.openvswitch.agent.ovs_neutron_agent.create_agent_config_map函数的典型用法代码示例。如果您正苦于以下问题:Python create_agent_config_map函数的具体用法?Python create_agent_config_map怎么用?Python create_agent_config_map使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_agent_config_map函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_create_agent_config_map_fails_for_invalid_tunnel_config
def test_create_agent_config_map_fails_for_invalid_tunnel_config(self):
self.addCleanup(cfg.CONF.reset)
# An ip address is required for tunneling but there is no default
cfg.CONF.set_override('tunnel_type', constants.TYPE_GRE,
group='AGENT')
with testtools.ExpectedException(ValueError):
ovs_neutron_agent.create_agent_config_map(cfg.CONF)
示例2: test_create_agent_config_map_fails_for_invalid_tunnel_config
def test_create_agent_config_map_fails_for_invalid_tunnel_config(self):
# An ip address is required for tunneling but there is no default,
# verify this for both gre and vxlan tunnels.
cfg.CONF.set_override("tunnel_types", [p_const.TYPE_GRE], group="AGENT")
with testtools.ExpectedException(ValueError):
ovs_neutron_agent.create_agent_config_map(cfg.CONF)
cfg.CONF.set_override("tunnel_types", [p_const.TYPE_VXLAN], group="AGENT")
with testtools.ExpectedException(ValueError):
ovs_neutron_agent.create_agent_config_map(cfg.CONF)
示例3: setUp
def setUp(self):
super(TestOvsNeutronAgent, self).setUp()
notifier_p = mock.patch(NOTIFIER)
notifier_cls = notifier_p.start()
self.notifier = mock.Mock()
notifier_cls.return_value = self.notifier
# Avoid rpc initialization for unit tests
cfg.CONF.set_override("rpc_backend", "neutron.openstack.common.rpc.impl_fake")
kwargs = ovs_neutron_agent.create_agent_config_map(cfg.CONF)
class MockFixedIntervalLoopingCall(object):
def __init__(self, f):
self.f = f
def start(self, interval=0):
self.f()
with contextlib.nested(
mock.patch(
"neutron.plugins.openvswitch.agent.ovs_neutron_agent." "OVSNeutronAgent.setup_integration_br",
return_value=mock.Mock(),
),
mock.patch(
"neutron.plugins.openvswitch.agent.ovs_neutron_agent." "OVSNeutronAgent.setup_ancillary_bridges",
return_value=[],
),
mock.patch("neutron.agent.linux.ovs_lib.OVSBridge." "get_local_port_mac", return_value="00:00:00:00:00:01"),
mock.patch("neutron.agent.linux.utils.get_interface_mac", return_value="00:00:00:00:00:01"),
mock.patch(
"neutron.openstack.common.loopingcall." "FixedIntervalLoopingCall", new=MockFixedIntervalLoopingCall
),
):
self.agent = ovs_neutron_agent.OVSNeutronAgent(**kwargs)
self.agent.tun_br = mock.Mock()
self.agent.sg_agent = mock.Mock()
示例4: create_agent_config_map
def create_agent_config_map(conf):
agent_config = ovs.create_agent_config_map(conf)
agent_config['hybrid_mode'] = conf.OPFLEX.hybrid_mode
agent_config['epg_mapping_dir'] = conf.OPFLEX.epg_mapping_dir
agent_config['opflex_networks'] = conf.OPFLEX.opflex_networks
agent_config['internal_floating_ip_pool'] = (
conf.OPFLEX.internal_floating_ip_pool)
agent_config['internal_floating_ip6_pool'] = (
conf.OPFLEX.internal_floating_ip6_pool)
# DVR not supported
agent_config['enable_distributed_routing'] = False
# ARP responder not supported
agent_config['arp_responder'] = False
# read external-segment next-hop info
es_info = {}
multi_parser = cfg.MultiConfigParser()
multi_parser.read(conf.config_file)
for parsed_file in multi_parser.parsed:
for parsed_item in parsed_file.keys():
if parsed_item.startswith('opflex_external_segment:'):
es_name = parsed_item.split(':', 1)[1]
if es_name:
es_info[es_name] = parsed_file[parsed_item].items()
agent_config['external_segment'] = es_info
agent_config['dhcp_domain'] = conf.dhcp_domain
return agent_config
示例5: test_create_agent_config_map_enable_tunneling
def test_create_agent_config_map_enable_tunneling(self):
# Verify setting only enable_tunneling will default tunnel_type to GRE
cfg.CONF.set_override("tunnel_types", None, group="AGENT")
cfg.CONF.set_override("enable_tunneling", True, group="OVS")
cfg.CONF.set_override("local_ip", "10.10.10.10", group="OVS")
cfgmap = ovs_neutron_agent.create_agent_config_map(cfg.CONF)
self.assertEqual(cfgmap["tunnel_types"], [p_const.TYPE_GRE])
示例6: test_create_agent_config_map_enable_distributed_routing
def test_create_agent_config_map_enable_distributed_routing(self):
self.addCleanup(cfg.CONF.reset)
# Verify setting only enable_tunneling will default tunnel_type to GRE
cfg.CONF.set_override('enable_distributed_routing', True,
group='AGENT')
cfgmap = ovs_neutron_agent.create_agent_config_map(cfg.CONF)
self.assertEqual(cfgmap['enable_distributed_routing'], True)
示例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)
try:
agent_config = ovs_neutron_agent.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(**agent_config)
signal.signal(signal.SIGTERM, agent._handle_sigterm)
# Start everything.
LOG.info(_LI("Agent initialized successfully, now running... "))
agent.daemon_loop()
示例8: test_create_agent_config_map_multiple_tunnel_types
def test_create_agent_config_map_multiple_tunnel_types(self):
cfg.CONF.set_override('local_ip', '10.10.10.10', group='OVS')
cfg.CONF.set_override('tunnel_types', [p_const.TYPE_GRE,
p_const.TYPE_VXLAN], group='AGENT')
cfgmap = ovs_neutron_agent.create_agent_config_map(cfg.CONF)
self.assertEqual(cfgmap['tunnel_types'],
[p_const.TYPE_GRE, p_const.TYPE_VXLAN])
示例9: setUp
def setUp(self):
super(TestOvsNeutronAgent, self).setUp()
self.addCleanup(cfg.CONF.reset)
self.addCleanup(mock.patch.stopall)
notifier_p = mock.patch(NOTIFIER)
notifier_cls = notifier_p.start()
self.notifier = mock.Mock()
notifier_cls.return_value = self.notifier
# Avoid rpc initialization for unit tests
cfg.CONF.set_override('rpc_backend',
'neutron.openstack.common.rpc.impl_fake')
cfg.CONF.set_override('report_interval', 0, 'AGENT')
kwargs = ovs_neutron_agent.create_agent_config_map(cfg.CONF)
with contextlib.nested(
mock.patch('neutron.plugins.openvswitch.agent.ovs_neutron_agent.'
'OVSNeutronAgent.setup_integration_br',
return_value=mock.Mock()),
mock.patch('neutron.plugins.openvswitch.agent.ovs_neutron_agent.'
'OVSNeutronAgent.setup_ancillary_bridges',
return_value=[]),
mock.patch('neutron.agent.linux.ovs_lib.OVSBridge.'
'get_local_port_mac',
return_value='00:00:00:00:00:01'),
mock.patch('neutron.agent.linux.utils.get_interface_mac',
return_value='00:00:00:00:00:01')):
self.agent = ovs_neutron_agent.OVSNeutronAgent(**kwargs)
self.agent.tun_br = mock.Mock()
self.agent.sg_agent = mock.Mock()
示例10: setUp
def setUp(self):
super(AncillaryBridgesTest, self).setUp()
notifier_p = mock.patch(NOTIFIER)
notifier_cls = notifier_p.start()
self.notifier = mock.Mock()
notifier_cls.return_value = self.notifier
cfg.CONF.set_default("firewall_driver", "neutron.agent.firewall.NoopFirewallDriver", group="SECURITYGROUP")
cfg.CONF.set_override("report_interval", 0, "AGENT")
self.kwargs = ovs_neutron_agent.create_agent_config_map(cfg.CONF)
示例11: create_agent_config_map
def create_agent_config_map(conf):
agent_config = ovs.create_agent_config_map(conf)
agent_config['hybrid_mode'] = conf.OPFLEX.hybrid_mode
agent_config['epg_mapping_dir'] = conf.OPFLEX.epg_mapping_dir
agent_config['opflex_networks'] = conf.OPFLEX.opflex_networks
# DVR not supported
agent_config['enable_distributed_routing'] = False
# ARP responder not supported
agent_config['arp_responder'] = False
return agent_config
示例12: setUp
def setUp(self):
super(AncillaryBridgesTest, self).setUp()
notifier_p = mock.patch(NOTIFIER)
notifier_cls = notifier_p.start()
self.notifier = mock.Mock()
notifier_cls.return_value = self.notifier
cfg.CONF.set_default('firewall_driver',
'neutron.agent.firewall.NoopFirewallDriver',
group='SECURITYGROUP')
# Avoid rpc initialization for unit tests
cfg.CONF.set_override('rpc_backend',
'neutron.openstack.common.rpc.impl_fake')
cfg.CONF.set_override('report_interval', 0, 'AGENT')
self.kwargs = ovs_neutron_agent.create_agent_config_map(cfg.CONF)
示例13: setUp
def setUp(self):
super(TestOvsNeutronAgent, self).setUp()
notifier_p = mock.patch(NOTIFIER)
notifier_cls = notifier_p.start()
self.notifier = mock.Mock()
notifier_cls.return_value = self.notifier
cfg.CONF.set_default('firewall_driver',
'neutron.agent.firewall.NoopFirewallDriver',
group='SECURITYGROUP')
# Avoid rpc initialization for unit tests
cfg.CONF.set_override('rpc_backend',
'neutron.openstack.common.rpc.impl_fake')
kwargs = ovs_neutron_agent.create_agent_config_map(cfg.CONF)
class MockFixedIntervalLoopingCall(object):
def __init__(self, f):
self.f = f
def start(self, interval=0):
self.f()
with contextlib.nested(
mock.patch('neutron.plugins.openvswitch.agent.ovs_neutron_agent.'
'OVSNeutronAgent.setup_integration_br',
return_value=mock.Mock()),
mock.patch('neutron.plugins.openvswitch.agent.ovs_neutron_agent.'
'OVSNeutronAgent.setup_ancillary_bridges',
return_value=[]),
mock.patch('neutron.agent.linux.ovs_lib.OVSBridge.'
'create'),
mock.patch('neutron.agent.linux.ovs_lib.OVSBridge.'
'set_secure_mode'),
mock.patch('neutron.agent.linux.ovs_lib.OVSBridge.'
'get_local_port_mac',
return_value='00:00:00:00:00:01'),
mock.patch('neutron.agent.linux.utils.get_interface_mac',
return_value='00:00:00:00:00:01'),
mock.patch('neutron.agent.linux.ovs_lib.'
'get_bridges'),
mock.patch('neutron.openstack.common.loopingcall.'
'FixedIntervalLoopingCall',
new=MockFixedIntervalLoopingCall),
mock.patch('neutron.plugins.openvswitch.agent.ovs_neutron_agent.'
'OVSNeutronAgent._check_arp_responder_support',
return_value=True)):
self.agent = ovs_neutron_agent.OVSNeutronAgent(**kwargs)
self.agent.tun_br = mock.Mock()
self.agent.sg_agent = mock.Mock()
示例14: setUp
def setUp(self):
super(TestOvsDvrNeutronAgent, self).setUp()
notifier_p = mock.patch(NOTIFIER)
notifier_cls = notifier_p.start()
self.notifier = mock.Mock()
notifier_cls.return_value = self.notifier
cfg.CONF.set_default('firewall_driver',
'neutron.agent.firewall.NoopFirewallDriver',
group='SECURITYGROUP')
kwargs = ovs_neutron_agent.create_agent_config_map(cfg.CONF)
class MockFixedIntervalLoopingCall(object):
def __init__(self, f):
self.f = f
def start(self, interval=0):
self.f()
with contextlib.nested(
mock.patch('neutron.plugins.openvswitch.agent.ovs_neutron_agent.'
'OVSNeutronAgent.setup_integration_br',
return_value=mock.Mock()),
mock.patch('neutron.plugins.openvswitch.agent.ovs_neutron_agent.'
'OVSNeutronAgent.setup_ancillary_bridges',
return_value=[]),
mock.patch('neutron.agent.linux.ovs_lib.OVSBridge.'
'create'),
mock.patch('neutron.agent.linux.ovs_lib.OVSBridge.'
'set_secure_mode'),
mock.patch('neutron.agent.linux.ovs_lib.OVSBridge.'
'get_local_port_mac',
return_value='00:00:00:00:00:01'),
mock.patch('neutron.agent.linux.utils.get_interface_mac',
return_value='00:00:00:00:00:01'),
mock.patch('neutron.agent.linux.ovs_lib.BaseOVS.get_bridges'),
mock.patch('neutron.openstack.common.loopingcall.'
'FixedIntervalLoopingCall',
new=MockFixedIntervalLoopingCall)):
self.agent = ovs_neutron_agent.OVSNeutronAgent(**kwargs)
# set back to true because initial report state will succeed due
# to mocked out RPC calls
self.agent.use_call = True
self.agent.tun_br = mock.Mock()
self.agent.sg_agent = mock.Mock()
示例15: setUp
def setUp(self):
super(TestOvsNeutronAgent, self).setUp()
self.addCleanup(cfg.CONF.reset)
self.addCleanup(mock.patch.stopall)
notifier_p = mock.patch(NOTIFIER)
notifier_cls = notifier_p.start()
self.notifier = mock.Mock()
notifier_cls.return_value = self.notifier
# Avoid rpc initialization for unit tests
cfg.CONF.set_override("rpc_backend", "neutron.openstack.common.rpc.impl_fake")
cfg.CONF.set_override("report_interval", 0, "AGENT")
kwargs = ovs_neutron_agent.create_agent_config_map(cfg.CONF)
with contextlib.nested(
mock.patch(
"neutron.plugins.openvswitch.agent.ovs_neutron_agent." "OVSNeutronAgent.setup_integration_br",
return_value=mock.Mock(),
),
mock.patch("neutron.agent.linux.utils.get_interface_mac", return_value="00:00:00:00:00:01"),
):
self.agent = ovs_neutron_agent.OVSNeutronAgent(**kwargs)
self.agent.tun_br = mock.Mock()
self.agent.sg_agent = mock.Mock()