本文整理匯總了Python中charmhelpers.contrib.openstack.context.NeutronContext方法的典型用法代碼示例。如果您正苦於以下問題:Python context.NeutronContext方法的具體用法?Python context.NeutronContext怎麽用?Python context.NeutronContext使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類charmhelpers.contrib.openstack.context
的用法示例。
在下文中一共展示了context.NeutronContext方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_neutron_n1kv_plugin_context
# 需要導入模塊: from charmhelpers.contrib.openstack import context [as 別名]
# 或者: from charmhelpers.contrib.openstack.context import NeutronContext [as 別名]
def test_neutron_n1kv_plugin_context(self, attr, ip, sec_groups, config):
ip.return_value = '10.0.0.1'
sec_groups.__get__ = MagicMock(return_value=True)
attr.return_value = 'some.quantum.driver.class'
config.return_value = 'n1kv'
neutron = context.NeutronContext()
self.assertEquals({
'core_plugin': 'some.quantum.driver.class',
'neutron_plugin': 'n1kv',
'neutron_security_groups': True,
'local_ip': '10.0.0.1',
'config': 'some.quantum.driver.class',
'vsm_ip': 'n1kv',
'vsm_username': 'n1kv',
'vsm_password': 'n1kv',
'user_config_flags': {},
'restrict_policy_profiles': 'n1kv',
}, neutron.n1kv_ctxt())
示例2: test_neutron_neutron_ctxt
# 需要導入模塊: from charmhelpers.contrib.openstack import context [as 別名]
# 或者: from charmhelpers.contrib.openstack.context import NeutronContext [as 別名]
def test_neutron_neutron_ctxt(self, mock_network_manager,
mock_unit_get):
vip = '88.11.22.33'
priv_addr = '10.0.0.1'
mock_unit_get.return_value = priv_addr
neutron = context.NeutronContext()
config = {'vip': vip}
self.config.side_effect = lambda key: config[key]
mock_network_manager.__get__ = Mock(return_value='neutron')
self.is_clustered.return_value = False
self.assertEquals(
{'network_manager': 'neutron',
'neutron_url': 'https://%s:9696' % (priv_addr)},
neutron.neutron_ctxt()
)
self.is_clustered.return_value = True
self.assertEquals(
{'network_manager': 'neutron',
'neutron_url': 'https://%s:9696' % (vip)},
neutron.neutron_ctxt()
)
示例3: test_neutron_neutron_ctxt_http
# 需要導入模塊: from charmhelpers.contrib.openstack import context [as 別名]
# 或者: from charmhelpers.contrib.openstack.context import NeutronContext [as 別名]
def test_neutron_neutron_ctxt_http(self, mock_network_manager,
mock_unit_get):
vip = '88.11.22.33'
priv_addr = '10.0.0.1'
mock_unit_get.return_value = priv_addr
neutron = context.NeutronContext()
config = {'vip': vip}
self.config.side_effect = lambda key: config[key]
self.https.return_value = False
mock_network_manager.__get__ = Mock(return_value='neutron')
self.is_clustered.return_value = False
self.assertEquals(
{'network_manager': 'neutron',
'neutron_url': 'http://%s:9696' % (priv_addr)},
neutron.neutron_ctxt()
)
self.is_clustered.return_value = True
self.assertEquals(
{'network_manager': 'neutron',
'neutron_url': 'http://%s:9696' % (vip)},
neutron.neutron_ctxt()
)
示例4: plugin
# 需要導入模塊: from charmhelpers.contrib.openstack import context [as 別名]
# 或者: from charmhelpers.contrib.openstack.context import NeutronContext [as 別名]
def plugin(self):
'''
Over-riding function in NeutronContext Class to return 'plumgrid'
as the neutron plugin.
'''
return 'plumgrid'
示例5: network_manager
# 需要導入模塊: from charmhelpers.contrib.openstack import context [as 別名]
# 或者: from charmhelpers.contrib.openstack.context import NeutronContext [as 別名]
def network_manager(self):
'''
Over-riding function in NeutronContext Class to return 'neutron'
as the network manager.
'''
return 'neutron'
示例6: _save_flag_file
# 需要導入模塊: from charmhelpers.contrib.openstack import context [as 別名]
# 或者: from charmhelpers.contrib.openstack.context import NeutronContext [as 別名]
def _save_flag_file(self):
'''
Over-riding function in NeutronContext Class.
Function only needed for OVS.
'''
pass
示例7: _ensure_packages
# 需要導入模塊: from charmhelpers.contrib.openstack import context [as 別名]
# 或者: from charmhelpers.contrib.openstack.context import NeutronContext [as 別名]
def _ensure_packages(self):
'''
Over-riding function in NeutronContext Class.
Function only runs on compute nodes.
'''
pass
示例8: test_neutron_context_base_properties
# 需要導入模塊: from charmhelpers.contrib.openstack import context [as 別名]
# 或者: from charmhelpers.contrib.openstack.context import NeutronContext [as 別名]
def test_neutron_context_base_properties(self, attr):
'''Test neutron context base properties'''
neutron = context.NeutronContext()
attr.return_value = 'quantum-plugin-package'
self.assertEquals(None, neutron.plugin)
self.assertEquals(None, neutron.network_manager)
self.assertEquals(None, neutron.neutron_security_groups)
self.assertEquals('quantum-plugin-package', neutron.packages)
示例9: test_neutron_ensure_package
# 需要導入模塊: from charmhelpers.contrib.openstack import context [as 別名]
# 或者: from charmhelpers.contrib.openstack.context import NeutronContext [as 別名]
def test_neutron_ensure_package(self, _filter, _install, _packages):
'''Test neutron context installed required packages'''
_filter.return_value = ['quantum-plugin-package']
_packages.return_value = [['quantum-plugin-package']]
neutron = context.NeutronContext()
neutron._ensure_packages()
_install.assert_called_with(['quantum-plugin-package'], fatal=True)
示例10: test_neutron_ovs_plugin_context
# 需要導入模塊: from charmhelpers.contrib.openstack import context [as 別名]
# 或者: from charmhelpers.contrib.openstack.context import NeutronContext [as 別名]
def test_neutron_ovs_plugin_context(self, attr, ip, sec_groups):
ip.return_value = '10.0.0.1'
sec_groups.__get__ = MagicMock(return_value=True)
attr.return_value = 'some.quantum.driver.class'
neutron = context.NeutronContext()
self.assertEquals({
'config': 'some.quantum.driver.class',
'core_plugin': 'some.quantum.driver.class',
'neutron_plugin': 'ovs',
'neutron_security_groups': True,
'local_ip': '10.0.0.1'}, neutron.ovs_ctxt())
示例11: test_neutron_nvp_plugin_context
# 需要導入模塊: from charmhelpers.contrib.openstack import context [as 別名]
# 或者: from charmhelpers.contrib.openstack.context import NeutronContext [as 別名]
def test_neutron_nvp_plugin_context(self, attr, ip, sec_groups):
ip.return_value = '10.0.0.1'
sec_groups.__get__ = MagicMock(return_value=True)
attr.return_value = 'some.quantum.driver.class'
neutron = context.NeutronContext()
self.assertEquals({
'config': 'some.quantum.driver.class',
'core_plugin': 'some.quantum.driver.class',
'neutron_plugin': 'nvp',
'neutron_security_groups': True,
'local_ip': '10.0.0.1'}, neutron.nvp_ctxt())
示例12: test_neutron_plumgrid_plugin_context
# 需要導入模塊: from charmhelpers.contrib.openstack import context [as 別名]
# 或者: from charmhelpers.contrib.openstack.context import NeutronContext [as 別名]
def test_neutron_plumgrid_plugin_context(self, attr, ip, sec_groups):
ip.return_value = '10.0.0.1'
sec_groups.__get__ = MagicMock(return_value=True)
attr.return_value = 'some.quantum.driver.class'
neutron = context.NeutronContext()
self.assertEquals({
'config': 'some.quantum.driver.class',
'core_plugin': 'some.quantum.driver.class',
'neutron_plugin': 'plumgrid',
'neutron_security_groups': True,
'local_ip': '10.0.0.1'}, neutron.pg_ctxt())
示例13: test_neutron_nuage_plugin_context
# 需要導入模塊: from charmhelpers.contrib.openstack import context [as 別名]
# 或者: from charmhelpers.contrib.openstack.context import NeutronContext [as 別名]
def test_neutron_nuage_plugin_context(self, attr, ip, sec_groups):
ip.return_value = '10.0.0.1'
sec_groups.__get__ = MagicMock(return_value=True)
attr.return_value = 'some.quantum.driver.class'
neutron = context.NeutronContext()
self.assertEquals({
'config': 'some.quantum.driver.class',
'core_plugin': 'some.quantum.driver.class',
'neutron_plugin': 'vsp',
'neutron_security_groups': True,
'local_ip': '10.0.0.1'}, neutron.nuage_ctxt())
示例14: test_neutron_midonet_plugin_context
# 需要導入模塊: from charmhelpers.contrib.openstack import context [as 別名]
# 或者: from charmhelpers.contrib.openstack.context import NeutronContext [as 別名]
def test_neutron_midonet_plugin_context(self, attr, ip, sec_groups):
ip.return_value = '10.0.0.1'
sec_groups.__get__ = MagicMock(return_value=True)
attr.return_value = 'some.quantum.driver.class'
neutron = context.NeutronContext()
self.assertEquals({
'config': 'some.quantum.driver.class',
'core_plugin': 'some.quantum.driver.class',
'neutron_plugin': 'midonet',
'neutron_security_groups': True,
'local_ip': '10.0.0.1'}, neutron.midonet_ctxt())
示例15: test_neutron_main_context_gen_nvp_and_alchemy
# 需要導入模塊: from charmhelpers.contrib.openstack import context [as 別名]
# 或者: from charmhelpers.contrib.openstack.context import NeutronContext [as 別名]
def test_neutron_main_context_gen_nvp_and_alchemy(self,
mock_network_manager,
mock_ensure_packages,
mock_plugin,
mock_nvp_ctxt,
mock_neutron_ctxt):
mock_neutron_ctxt.return_value = {'network_manager': 'neutron',
'neutron_url': 'https://foo:9696'}
config = {'neutron-alchemy-flags': 'pool_size=20'}
self.config.side_effect = lambda key: config[key]
neutron = context.NeutronContext()
mock_network_manager.__get__ = Mock(return_value='flatdhcpmanager')
mock_plugin.__get__ = Mock()
self.assertEquals({}, neutron())
self.assertTrue(mock_network_manager.__get__.called)
self.assertFalse(mock_plugin.__get__.called)
mock_network_manager.__get__.return_value = 'neutron'
mock_plugin.__get__ = Mock(return_value=None)
self.assertEquals({}, neutron())
self.assertTrue(mock_plugin.__get__.called)
mock_nvp_ctxt.return_value = {'nvp': 'nvp_context'}
mock_plugin.__get__.return_value = 'nvp'
self.assertEquals(
{'network_manager': 'neutron',
'nvp': 'nvp_context',
'neutron_alchemy_flags': {'pool_size': '20'},
'neutron_url': 'https://foo:9696'},
neutron()
)